This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Virtual inheritance and protected members


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 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]