home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / object / 2962 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  1.6 KB

  1. Path: sparky!uunet!mcsun!Germany.EU.net!unido!ubrinf!lehre23!lucy
  2. From: lucy@lehre23.informatik.Uni-Bremen.DE (Holger Burde)
  3. Newsgroups: comp.object
  4. Subject: Re: "has-a" relation in C++ ? How ?
  5. Message-ID: <1992Jul22.142046.2003@informatik.uni-bremen.de>
  6. Date: 22 Jul 92 14:20:46 GMT
  7. Sender: lucy@lehre23 (Holger Burde)
  8. Organization: Universitaet Bremen
  9. Lines: 41
  10. Nntp-Posting-Host: lehre23
  11.  
  12.  
  13. In article <1992Jul20.212525.5081@dsg.tandem.com> narayan@aravali.everest.tandem.com (Pankaj Narayan) writes:
  14. >Books typically go over the "is-a" relationship in much detail, saying how
  15. >C++ has this great inheritance mechanism to support this sort of a relationship.
  16. >
  17. >However, when it comes to the "has-a" relationship, they don't really talk about
  18. >or give implementation examples of how that is done in C++.  The Coad/Yourdon
  19. >OOD book talks a little about it, and says that it can be done in a couple of ways,
  20. >but does not give any substantial example.
  21. >
  22. >>    Thats because you already know how to do it.
  23.  
  24. >>    struct X { 
  25.  
  26. >>        Y y;
  27.  
  28.     };
  29.  
  30. >>X 'has-a' Y, namely, y.
  31.  
  32.  
  33. what if you are facing a multilevel aggregat object ?
  34.  
  35.        
  36.                    Car
  37.                  -has-a-
  38.       ....  doors  wheels engine .....
  39.              
  40.     .....                            ....
  41.  
  42.            lots of subcomponet levels of each subcomponent
  43.             
  44.  
  45. i don't see how to represent this with a struct.   
  46.  
  47.  
  48. CAx applications often deal with such objects. so far read objects have
  49. a set (or array) of pointers to subcomponet level object.
  50.  
  51. try 'Object Oriented Databases with Applications to CASE, Networks, and
  52. VLSI CAD' (R. Gupta,E. Horowitz) p.h. 1991).  
  53.