[comp.lang.c++] constructors and derived types

schmidt@glacier.ics.uci.edu (Doug Schmidt) (11/22/88)

Hi,

   Can someone please inform me as to whether the following is legitimate
C++:

----------------------------------------
class Foo {  // A much simplified example
public:   
   Foo ( void ) { } 
};

class Foo_Bar : Foo { 
// Foo is a non-public base class and Foo_Bar has no constructor
   public: 
};

main () { 
   Foo_Bar X; 
}
----------------------------------------

cfront 1.2.1 complains that:

----------------------------------------
CC  question.C:
"question.C", line 5: error:  Foo::Foo() is from a private base class
1 error
----------------------------------------

but G++ 1.27 compiles it without a squawk.  If a constructor is added to
Foo_Bar, then cfront accepts it also.  

thanks,

Doug Schmidt
--
schmidt@bonnie.ics.uci.edu (ARPA) |   Per me si va nella cita dolente.
                                  |   Per me si va nell' etterno dolore.
                                  |   Per me si va tra la perduta gente.
                                  |   Lasciate ogni speranza voi ch' entrate.