schwartz@shire.cs.psu.edu (Scott Schwartz) (05/11/89)
Is it possible to declare an aggregate containing references? Something like Class& vec[] = ??? is what I had in mind, but don't see how to make the initializations work out. -- Scott Schwartz <schwartz@shire.cs.psu.edu> "Imake is a cruel hoax"
turner@sdti.SDTI.COM (Prescott K. Turner) (05/12/89)
In article <4569@psuvax1.cs.psu.edu> schwartz@shire.cs.psu.edu (Scott Schwartz) writes: >Is it possible to declare an aggregate containing references? >Something like > Class& vec[] = ??? >is what I had in mind, but don't see how to make the initializations >work out. Arrays of references are not allowed. But a reference can be a member of a class, just initialize it in the base/member initializer. int n; class C { int & intref; C () : intref (n) {} }; -- Prescott K. Turner, Jr. Software Development Technologies, Inc. P.O. Box 366, Sudbury, MA 01776 USA (508) 443-5779 UUCP: ...{harvard,mit-eddie}!sdti!turner Internet: turner@sdti.sdti.com