eppstein@garfield (David Eppstein) (05/07/89)
If one class is derived (not publically) from a second class, the
derived class can still use the parent's public members.
But if the parent class is itself derived (publically), g++ screws up:
it disallows access to the grandparent's public members, which should
have been inherited from the parent.
------------ code illustrating the bug ------------
class a { public: int foo(); };
class b : public a { public: int baz(); };
class c : b { int bar() { return foo() + baz(); }; };
------------ g++ output when run on sample ------------
g++ version 1.32.0
/usr/local/gnu/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dvax -Dunix test.c /tmp/cc026645.cpp
GNU CPP version 1.33
/usr/local/gnu/lib/gcc-c++ /tmp/cc026645.cpp -quiet -dumpbase test.c -version -o /tmp/cc026645.s
GNU C++ version 1.32.0 (vax) compiled by GNU C version 1.33.
In function c::bar ():
test.c:1: method int a::foo () is private
--
David Eppstein eppstein@garfield.cs.columbia.edu Columbia U. Computer Science