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

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Re: Private base classes
  5. Message-ID: <1992Dec23.145841.3352@ucc.su.OZ.AU>
  6. Sender: news@ucc.su.OZ.AU
  7. Nntp-Posting-Host: extro.ucc.su.oz.au
  8. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  9. References: <921221185102_76336.3114_EHJ5-2@CompuServe.COM>
  10. Date: Wed, 23 Dec 1992 14:58:41 GMT
  11. Lines: 48
  12.  
  13. In article <921221185102_76336.3114_EHJ5-2@CompuServe.COM> 76336.3114@CompuServe.COM (Kevin Dean) writes:
  14. >From John Max Skeller, <1992Dec19.185132.13319@ucc.su.OZ.AU>:
  15. >
  16. >>In article <921216205429_76336.3114_EHJ34-2@CompuServe.COM>
  17. >>76336.3114@CompuServe.COM (Kevin Dean) writes:
  18. >>>
  19. >>>I tried to do the following:
  20. >>>
  21. >>>class A {};
  22. >>>class B : private A {};
  23. >>>class C1 : public B, public A {};
  24. >>>
  25. >>>My compiler naturally warned me about A being both a direct and indirect
  26. >>>base class of C1 and so refused to compile it.
  27. >
  28. >>     It was nice for your compiler to warn you.
  29. >>     It was wrong for it to refuse your perfectly valid request.
  30. >>     Your compiler is broken.
  31. >
  32. >>     Replicated *direct* bases are illegal, if only because there would
  33. >>     be no way to disambiguate them.
  34. >
  35. >According to a note sent directly to me by Steve Clamage of TauMetric
  36. >Corp and, I believe, the C++ language committee, the construct is indeed
  37. >ambiguous because access rights are checked only after ambiguities are
  38. >resolved; trying to do it the other way around would introduce other
  39. >problems.  Given that access priviliges have no bearing on ambiguity
  40. >resolution, what I was trying to do is illegal.
  41.  
  42.     I'm sorry I dont understand. Its not possible for
  43. a class heirarchy to be ambiguous, only for an attempt to
  44. reference something in it. In the above I see no ambiguous
  45. references to anything. If there had been a function A::f,
  46. and you tried to call it, there would be an ambiguity.
  47.  
  48.     So figure this one:
  49.  
  50.     class A ..... // hint hint
  51.     class B : public A { ... }
  52.     class C : public B, public A { ...}
  53.  
  54. It is possible to access BOTH A subobjects of C. How?
  55.  
  56. -- 
  57. ;----------------------------------------------------------------------
  58.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  59.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  60. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  61.