yy 发帖数: 45 | 1 请问
如果一个class A 没有定义任何的constructor,
A arrayA[10]; will be legal, for each element, will be initialized with
the compiler's default constructor.
如果 class A, 定义了一个 constructor like:
A(int number);
则: A arrayA[10]; will be illega since there lack of a default consturctor.
请问, 我得理解对吗?
谢谢 | c********e 发帖数: 383 | 2 right, you could do
A arrayA[10] = {A(2), A(2)...};
【在 yy 的大作中提到】 : 请问 : 如果一个class A 没有定义任何的constructor, : A arrayA[10]; will be legal, for each element, will be initialized with : the compiler's default constructor. : 如果 class A, 定义了一个 constructor like: : A(int number); : 则: A arrayA[10]; will be illega since there lack of a default consturctor. : 请问, 我得理解对吗? : 谢谢
|
|