home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!unido!ubrinf!lehre23!lucy
- From: lucy@lehre23.informatik.Uni-Bremen.DE (Holger Burde)
- Newsgroups: comp.object
- Subject: Re: "has-a" relation in C++ ? How ?
- Message-ID: <1992Jul22.142046.2003@informatik.uni-bremen.de>
- Date: 22 Jul 92 14:20:46 GMT
- Sender: lucy@lehre23 (Holger Burde)
- Organization: Universitaet Bremen
- Lines: 41
- Nntp-Posting-Host: lehre23
-
-
- In article <1992Jul20.212525.5081@dsg.tandem.com> narayan@aravali.everest.tandem.com (Pankaj Narayan) writes:
- >Books typically go over the "is-a" relationship in much detail, saying how
- >C++ has this great inheritance mechanism to support this sort of a relationship.
- >
- >However, when it comes to the "has-a" relationship, they don't really talk about
- >or give implementation examples of how that is done in C++. The Coad/Yourdon
- >OOD book talks a little about it, and says that it can be done in a couple of ways,
- >but does not give any substantial example.
- >
- >> Thats because you already know how to do it.
-
- >> struct X {
-
- >> Y y;
-
- };
-
- >>X 'has-a' Y, namely, y.
-
-
- what if you are facing a multilevel aggregat object ?
-
-
- Car
- -has-a-
- .... doors wheels engine .....
-
- ..... ....
-
- lots of subcomponet levels of each subcomponent
-
-
- i don't see how to represent this with a struct.
-
-
- CAx applications often deal with such objects. so far read objects have
- a set (or array) of pointers to subcomponet level object.
-
- try 'Object Oriented Databases with Applications to CASE, Networks, and
- VLSI CAD' (R. Gupta,E. Horowitz) p.h. 1991).
-