home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!utcsri!relay.cs.toronto.edu!compuserve.com!76336.3114
- Newsgroups: comp.lang.c++
- From: 76336.3114@CompuServe.COM (Kevin Dean)
- Subject: Private base classes
- Message-ID: <921221185102_76336.3114_EHJ5-2@CompuServe.COM>
- Date: 21 Dec 92 18:55:42 GMT
- Lines: 48
-
- From John Max Skeller, <1992Dec19.185132.13319@ucc.su.OZ.AU>:
-
- >In article <921216205429_76336.3114_EHJ34-2@CompuServe.COM>
- >76336.3114@CompuServe.COM (Kevin Dean) writes:
- >>
- >>I tried to do the following:
- >>
- >>class A {};
- >>class B : private A {};
- >>class C1 : public B, public A {};
- >>
- >>My compiler naturally warned me about A being both a direct and indirect
- >>base class of C1 and so refused to compile it.
-
- > It was nice for your compiler to warn you.
- > It was wrong for it to refuse your perfectly valid request.
- > Your compiler is broken.
-
- > Replicated *direct* bases are illegal, if only because there would
- > be no way to disambiguate them.
-
- According to a note sent directly to me by Steve Clamage of TauMetric
- Corp and, I believe, the C++ language committee, the construct is indeed
- ambiguous because access rights are checked only after ambiguities are
- resolved; trying to do it the other way around would introduce other
- problems. Given that access priviliges have no bearing on ambiguity
- resolution, what I was trying to do is illegal.
-
- However, that said, I still think there should be a way to do this, if
- only because, once a class is defined and documented, it can't be reliably
- changed even if the public and protected interfaces remain the same.
-
- >>In other words, I need to have forward
- >>knowledge of all classes that are or could be derived from B.
- >>Similarly,I need to know more about B than just its public and
- >>protected interfaces; I need to know what its private base classes are
- >>before I can reliably use it as a base class.
-
- > Yes, and this is why others believe private *should* mean
- >hidden, so you dont have to know about implementation details.
-
- >So what do you think of that?
-
- It's got my vote.
-
- Kevin Dean
-
-
-