This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Virtual inheritance and protected members
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: Virtual inheritance and protected members
- From: Mark Spruiell <mes at ooc dot com>
- Date: Fri, 12 Mar 1999 17:04:46 -0800
- Cc: support at ooc dot com
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