home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11459 < prev    next >
Encoding:
Internet Message Format  |  1992-07-23  |  1002 b 

  1. Path: sparky!uunet!sun-barr!apple!apple!netcomsv!delfin.com!hades!kinne
  2. From: kinne@delfin.com (Kinne Strong)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: classes referenced each in their declaration
  5. Message-ID: <1992Jul23.205454.16049@delfin.com>
  6. Date: 23 Jul 92 20:54:54 GMT
  7. References: <1992Jul23.003724.13021@murdoch.acc.Virginia.EDU>
  8. Sender: news@delfin.com (USENET on Delfin)
  9. Reply-To: kinne@netcom.com
  10. Organization: Foxglove Associates
  11. Lines: 26
  12. Nntp-Posting-Host: hades
  13. X-Newsreader: Tin 1.1 PL4
  14.  
  15. gs4t@virginia.edu (Gnanasekaran Swaminathan) writes:
  16. : class Y;
  17. : class X {
  18. :     Y&    y;
  19. :     public:
  20. :     X(const Y& y1): y(y1) {}
  21. : };
  22. : class Y {
  23. :     X    x;
  24. :     public:
  25. :     Y(): x(*this) {}
  26. :     Y(const Y& y): x(y) {}
  27. : };
  28.  
  29. That's cute. I like it.
  30.  
  31. It isn't clear to me that always having the Y contain an X that refers
  32. back to the containing Y is what the original poster wanted. In any
  33. case, what you have done probably can be generalized to get anything
  34. reasonable.
  35.  
  36. --
  37. Kinne Strong
  38. kinne@netcom.com
  39.