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