home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!apple!apple!netcomsv!delfin.com!hades!kinne
- From: kinne@delfin.com (Kinne Strong)
- Newsgroups: comp.lang.c++
- Subject: Re: classes referenced each in their declaration
- Message-ID: <1992Jul23.205454.16049@delfin.com>
- Date: 23 Jul 92 20:54:54 GMT
- References: <1992Jul23.003724.13021@murdoch.acc.Virginia.EDU>
- Sender: news@delfin.com (USENET on Delfin)
- Reply-To: kinne@netcom.com
- Organization: Foxglove Associates
- Lines: 26
- Nntp-Posting-Host: hades
- X-Newsreader: Tin 1.1 PL4
-
- gs4t@virginia.edu (Gnanasekaran Swaminathan) writes:
- : class Y;
- :
- : class X {
- : Y& y;
- : public:
- : X(const Y& y1): y(y1) {}
- : };
- :
- : class Y {
- : X x;
- : public:
- : Y(): x(*this) {}
- : Y(const Y& y): x(y) {}
- : };
-
- That's cute. I like it.
-
- It isn't clear to me that always having the Y contain an X that refers
- back to the containing Y is what the original poster wanted. In any
- case, what you have done probably can be generalized to get anything
- reasonable.
-
- --
- Kinne Strong
- kinne@netcom.com
-