🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by David Eppstein Sat, 06 May 1989 20:40
more serious bug: inaccessible indirect public member
#1952
Author: David Eppstein
Date: Sat, 06 May 1989 20:40
22 lines
1387 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads