home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18302 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  1.8 KB

  1. Path: sparky!uunet!spool.mu.edu!olivea!apple!voder!genie!roger
  2. From: roger@genie.UUCP (Roger H. Scott)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Virtual base classes
  5. Message-ID: <449@genie.UUCP>
  6. Date: 22 Dec 92 05:29:13 GMT
  7. References: <724475492snx@trmphrst.demon.co.uk>
  8. Reply-To: roger@genie.UUCP (Roger H. Scott)
  9. Organization: proCASE Corporation, Santa Clara, CA
  10. Lines: 23
  11.  
  12. In article <724475492snx@trmphrst.demon.co.uk> nikki@trmphrst.demon.co.uk writes:
  13. >In article <445@genie.UUCP> roger@genie.UUCP (Roger H. Scott) writes:
  14. >> If Kludge is a non-public subclass of WellFormed then there
  15. >> isn't much point in talking about Kludge redefining WellFormed's virtual
  16. >> functions since you can't use a Kludge in a place where a WellFormed is
  17. >> expected (i.e., who would ever have hold of a Kludge and send it one of
  18. >> WellFormed'd messages, other than a member function of Kludge?).
  19. >
  20. >Imagine that WellFormed's constructor adds all WellFormeds to some 
  21. >Collection of WellFormeds. Notice that all Kludges will also be added to 
  22. >this collection. Now imagine some calling some virtual function for all 
  23. >WellFormeds in the Collection.
  24.  
  25. This seems to raise an interesting question: does there exist an Is-A
  26. relationship between Kludge and WellFormed, and if not, what does it mean to
  27. have a collection of objects that *claim* to be WellFormeds but are in fact
  28. Kludges?  Do we see a small whole in the type system here, where within
  29. member functions inherited from a non-public base class an object which
  30. is in fact a Kludge can be used interchangably with an object that is a
  31. WellFormed (the example cited by Nikki uses the base class's constructor, but
  32. any member function of the base class will do)?  I'd like to see some sort
  33. of comprehensive statement about the (intended? actual?) semantics of non-
  34. public inheritance in C++.
  35.