Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!ogicse!orstcs!fog.CS.ORST.EDU!budd From: budd@fog.cs.orst.edu (Tim Budd) Newsgroups: comp.lang.c++ Subject: private inheritance in G++ 1.39 Message-ID: <1991Jun27.163527.25117@lynx.CS.ORST.EDU> Date: 27 Jun 91 16:35:27 GMT Sender: @lynx.CS.ORST.EDU Organization: Computer Science Department, Oregon State Univ. Lines: 32 Originator: budd@fog.CS.ORST.EDU Nntp-Posting-Host: fog.cs.orst.edu We've recently upgraded our g++ from 1.37 to 1.39. I have some code that used to work that now gives errors. So now I'm wondering if it is g++ 1.39 that is at fault or if my reading of ARM 11.2 and 11.3 is wrong. The problem involes private inheritance. Now it makes sense that when you inherit privately from a base class that defines a destructor you need to also make the destructor public in the subclass. The following example worked fine in 1.37, but complains about *both* the declarations now. (error message is ``type Two is derived from private One'' - a most uninformative error message since it tells me exactly what I already knew and what I wanted in any case. class One { public: one() {printf("in one \n"); } ~One() {} }; class Two : private One { public: two() { printf("in two\n"); } One::~One; }; class Three : public Two { public: three() { printf("in three\n"); } }; main() { Two x2; Three x3; }