Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!mips!sgi!shinobu!odin!rome.wpd.sgi.com!jfw From: jfw@rome.wpd.sgi.com (john fergus wilkinson) Newsgroups: comp.lang.c++ Subject: Re: Direct derivation of virtual base Message-ID: <1990Nov21.230629.25457@odin.corp.sgi.com> Date: 21 Nov 90 23:06:29 GMT References: <1990Nov19.211251.13416@ssd.kodak.com> Sender: news@odin.corp.sgi.com (Net News) Reply-To: jfw@rome.wpd.sgi.com (john fergus wilkinson) Distribution: usa Organization: Silicon Graphics, Inc., Mountain View, CA. Lines: 46 In article <1990Nov19.211251.13416@ssd.kodak.com>, randolph@ssd.kodak.com (Gary L. Randolph) writes: > > The following code results in the compile time error: > "tst.C", line 31: > error: main() cannot access f : X is a private base class > > WHY???????? > > > #include > > class X{ > public: > virtual void f(); > }; > > class Y : virtual private X{ > > > }; > > class Z : virtual private X{ > > > }; > > class XYZ : public Y, public Z, virtual public X{ > }; > > > void X::f() > { > cout<<"\nX::f() "; > } > > int main(){ > XYZ * xyzp = new XYZ; > xyzp->f(); //LINE 31 > } > > According to the Annotated Reference Manual (Section 11.7), this is a bug, and in fact it is fixed in cfront 2.1.