B
Bruno van Dooren
Hi all,
i am having a problems with inheritance.
consider the following:
class A
{
public:
A(int i){;}
};
class B: virtual public A
{
public:
B(int i) : A(i){;}
};
class C: virtual public B
{
public:
C(int i) : B(i){;} //raises error C2512: 'A::A' : no appropriate
default constructor available
};
can someone tell me why i get that error? it has to do with the fact that B
has virtual inheritance from A. if i make that non-virtual, the error is
gone. what is the impact of the 'virtual' keyword in this situation?
kind regards,
Bruno.
i am having a problems with inheritance.
consider the following:
class A
{
public:
A(int i){;}
};
class B: virtual public A
{
public:
B(int i) : A(i){;}
};
class C: virtual public B
{
public:
C(int i) : B(i){;} //raises error C2512: 'A::A' : no appropriate
default constructor available
};
can someone tell me why i get that error? it has to do with the fact that B
has virtual inheritance from A. if i make that non-virtual, the error is
gone. what is the impact of the 'virtual' keyword in this situation?
kind regards,
Bruno.