'A::A' :no appropriate default constructor available
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/08/03 08:47:43
'A::A' :no appropriate default constructor available
#include
class A
{
protected:
int a;
public:
A(int x)
{
a=x;
cout
#include
class A
{
protected:
int a;
public:
A(int x)
{
a=x;
cout
!['A::A' :no appropriate default constructor available](/uploads/image/z/7990175-47-5.jpg?t=%27A%3A%3AA%27+%3Ano+appropriate+default+constructor+available)
这个要改对的话只要在D的构造函数显式调用A的构造函数A(x)就可以了
D(int x):A(x),B(x),C(x)
这是一个典型的菱形继承结构
直接写
D(int x):B(x),C(x)
是有问题的,属于行为未定义,因为先调用B(x)还是C(x)在C++的标准中是没有定义的.虽然在很多编译环境中都是先B后C,但这并不可靠
effective c++中对这一结构进行了详细的剖析,感兴趣的话可以去好好看看
D(int x):A(x),B(x),C(x)
这是一个典型的菱形继承结构
直接写
D(int x):B(x),C(x)
是有问题的,属于行为未定义,因为先调用B(x)还是C(x)在C++的标准中是没有定义的.虽然在很多编译环境中都是先B后C,但这并不可靠
effective c++中对这一结构进行了详细的剖析,感兴趣的话可以去好好看看
'A::A' :no appropriate default constructor available
错误no appropriate default constructor available
/** Write a class Square whose constructor receives the leng
If Sample is a class,________ is correct copying constructor
英语翻译Default constructor cannot handle exception type FileNot
Form A available是什么意思
java错误Constructor call must be the first statement in a cons
Choose a more appropriate word from the bracket to complete
Fill in the blanks with appropriate pronouns or possessive a
英语翻译It should be a reachable objective,with the appropriate
you have no default printer
you can automatically create a .vmc file with default settin