home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
- From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
- Subject: Re: Private base classes
- Message-ID: <1992Dec23.145841.3352@ucc.su.OZ.AU>
- Sender: news@ucc.su.OZ.AU
- Nntp-Posting-Host: extro.ucc.su.oz.au
- Organization: MAXTAL P/L C/- University Computing Centre, Sydney
- References: <921221185102_76336.3114_EHJ5-2@CompuServe.COM>
- Date: Wed, 23 Dec 1992 14:58:41 GMT
- Lines: 48
-
- In article <921221185102_76336.3114_EHJ5-2@CompuServe.COM> 76336.3114@CompuServe.COM (Kevin Dean) writes:
- >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.
-
- I'm sorry I dont understand. Its not possible for
- a class heirarchy to be ambiguous, only for an attempt to
- reference something in it. In the above I see no ambiguous
- references to anything. If there had been a function A::f,
- and you tried to call it, there would be an ambiguity.
-
- So figure this one:
-
- class A ..... // hint hint
- class B : public A { ... }
- class C : public B, public A { ...}
-
- It is possible to access BOTH A subobjects of C. How?
-
- --
- ;----------------------------------------------------------------------
- JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
- Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
- ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
-