Virtual inheritance and protected members
Mark Spruiell
mes@ooc.com
Fri Mar 12 17:04:00 GMT 1999
The following example will not compile unless I remove the
virtual inheritance:
class A
{
protected:
bool flag_;
public:
A() { flag_ = true; }
};
class B : virtual public A
{
public:
B() { flag_ = false; }
};
Here is the output:
$ c++ -c test.cpp
test.cpp: In method `B::B()':
test.cpp:13: member `flag_' is protected
Other info:
$ c++ -v
Reading specs from
/opt/egcs-test/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.93.11/specs
gcc version egcs-2.93.11 19990307 (gcc2 ss-980929 experimental)
$ uname -a
Linux pc2 2.0.36 #1 Tue Oct 13 22:17:11 EDT 1998 i686 unknown
--
Mark E. Spruiell
Object-Oriented Concepts, Inc.
mes@ooc.com * http://www.ooc.com * 1-978-439-9285 x 247
More information about the Gcc-bugs
mailing list