Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!turner From: turner@s44.csrd.uiuc.edu (Steve Turner) Newsgroups: comp.lang.c++ Subject: default reference arguments Message-ID: Date: 17 Feb 90 03:05:11 GMT Sender: news@ux1.cso.uiuc.edu (News) Distribution: comp Organization: Center for Supercomputing R&D Lines: 35 I have a relatively simple question that I can't seem to find the answer to in my copy of Lippman or Stroustrup, and doesn't have a simple answer that I can think of. To wit: How do you declare the initializer for a default reference argument, particularly if the default value is a member of the same class? The following code fragment should make this more clear. class foo { public: int i; }; class bar // this is in file test.C { private: foo foobar; public: baz(foo &fooInstance=foobar); }; Basically, I would like to use the local data member as the argument, unless the routine calling bar::baz() supplies an alternative. Sadly AT&T 2.0 chokes on this with an error as: CC -c test.C CC test.C: "test.C", line 9: error: object or object pointer missing for bar::foobar 1 error Any help would be appreciated. I think this issue fell between the cracks in Lippman, because he discusses default arguments in section 3.5 (pg. 115) and reference arguments in section 3.7 (pg.119). Stroustrup was no help either (as usual, for me...) steve turner@uicsrd.csrd.uiuc.edu