网友您好, 请在下方输入框内输入要搜索的题目:
下列程序时类D代码段出现编译错误,原因是【 】。
include<iostream. h>
class A
{
public:
A(char c){cout<<"A's constructor."<<c<<endl;}
~A(){cout<<"A's destructor."<<endl;}
};
class B: virtual public A
{
public:
B(char cb,char cd):A(cb) {cout<<"B's constructor."<<cd<<endl;}
~B(){cout<<"B's destructor."<<endl;}
private:
char b;
};
class C:virtual public A
{
public:
C(char cc, char cd):A(cc)
{cout<<"C's constructor. "<<cd<<endl;}
~C(){cout<<"C's destructor."<<endl;}
};
class D:public B,public C
{
public:
D(char cd,char ce,char cf, char cg, char ch,char ci)
:C(cf,cg),B(cd,ce),A(cd),aa(ch)
{cout<<"D's constructor."<<ci<<endl;}
~D() {cout<<"D's destructor."<<endl;}
private:
A aa;
};
void main()
{
D ohj('a','b','c','d','e','f')
}
参考答案