2

i have three class like this:

class A
{
    public:
    A(int a){}
};
class B: virtual public A
{
    public:
    B(char c):A(5){}
}
class C: virtual public B
{
    public:
    C():B("a"){} //VC++ tells me that "class A doesn't have default constructor
}

Why class C's constructor needs to call class A's constructor again?

Clones1201
  • 333
  • 3
  • 17
  • C will call A's constructor instead of B now due to virtual inheritance. – Neil Kirk Oct 13 '14 at 15:53
  • http://stackoverflow.com/questions/17273524/why-only-base-class-default-constructor-is-called-in-virtual-base-multiple-inher http://stackoverflow.com/questions/2126522/c-virtual-inheritance – iampranabroy Oct 13 '14 at 17:13

0 Answers0