home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18480 < prev    next >
Encoding:
Text File  |  1992-12-29  |  1.2 KB  |  32 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watdragon.uwaterloo.ca!drraymon
  3. From: drraymon@watdragon.uwaterloo.ca (Darrell Raymond)
  4. Subject: Delegation? Composition? Layering? Containment?
  5. Message-ID: <Bzzqo4.E5J@watdragon.uwaterloo.ca>
  6. Organization: University of Waterloo
  7. Date: Mon, 28 Dec 1992 22:33:40 GMT
  8. Lines: 22
  9.  
  10.   One sometimes includes an instance of a class within a class, thus
  11. achieving information hiding without inheritance.   That is, instead
  12. of doing:
  13.  
  14. class foo : public bar { ....  }
  15.  
  16.   one would do
  17.  
  18. class foo { bar  x; ...  }
  19.  
  20.   My question is, what do people generally call the second technique?
  21. I have seen it described as `layering' (Meyers, Effective C++, p. 142),
  22. `composition' (Lippman, p. 415), `containment' (Stroustrup, p. 410),
  23. and I believe Gorlen et al. even refer to this as `delegation', which
  24. is what I used to call it.  I don't think it is delegation, however,
  25. since it does not confer the ability to redirect messages to an
  26. arbitrary object.
  27.  
  28.   Do people have a preference for one of the other terms?  I'll moderate 
  29. an e-mail vote and post the results, if anyone cares...
  30.  
  31. -Darrell.
  32.