peter@mit-amt.MEDIA.MIT.EDU (Peter Schroeder) (12/15/89)
// I sent this out some time ago but I am not sure it ever made it // beyond the local net... So, here goes again, sorry, if you've seen // this already. // I've recently built 2.0 with my old 1.2.1 cfront. I proceeded to have // the new compiler compile itself. This selfcompiled 2.0 behaves differently // then the 1.2.1 compiled 2.0. // Would some kind soul let me know whether they get an internal compiler // error when trying to compile the program attached below? // Notice that I only have an internal compiler error when I use the 2.0 // built with 2.0, NOT when I use the 2.0 built with 1.2.1 // I want to know whether this is a problem specific to my porting it on // the particular platform I am using. // Thank you for your help! // Peter // // peter@media-lab.media.mit.edu class base{ private: int a; public: int& bar() const; }; class derived : private base{ // this is line 8 public: base::bar; // the syntax is correct, isn't it? }; // CC /tmp/test.C: // "/tmp/test.C", line 8: internal <<AT&T C++ Translator 2.0 06/30/89>> error: // bus error (or something nasty like that)
Roy.Browning@f506.n106.z1.fidonet.org (Roy Browning) (12/18/89)
> From: peter@mit-amt.MEDIA.MIT.EDU (Peter Schroeder) > Date: 15 Dec 89 15:42:13 GMT > Organization: MIT Media Lab, Cambridge, MA > Message-ID: <1218@mit-amt.MEDIA.MIT.EDU> > Newsgroups: comp.lang.c++ > class base{ > private: > int a; > public: > int& bar() const; > }; > > class derived : private base{ // this is line 8 > public: > base::bar; // the syntax is correct, isn't it? > }; Peter: Your code fragment compiles without complaint using the latest version of Zortech C++. You are explicitly allowing the same level of access in the derived class as the base class. According to Lippman page 318 you should be able to exempt individual members from the private derivation. A quick answer, Roy Browning