c*******9 发帖数: 6411 | 1 class A {
void f();
};
will there be a default constructor generated for this? |
P********e 发帖数: 2610 | 2 有4个default function 你自己查查
【在 c*******9 的大作中提到】 : class A { : void f(); : }; : will there be a default constructor generated for this?
|
S**I 发帖数: 15689 | 3 yes; default constructor, copy constructor, assignment constructor and
destructor will be automatically generated if no definition is given.
【在 c*******9 的大作中提到】 : class A { : void f(); : }; : will there be a default constructor generated for this?
|
c*******9 发帖数: 6411 | 4 so the default construct are empty since there are no data member? |
j***i 发帖数: 1278 | 5 这个情况不需要把
From inside C++ obj model
There are four characteristics(Member Class Object with Default Constructor,
Base Class with Default Constructor,Class with a Virtual Function, Class wi
th a Virtual Base Class) of a class under which the compiler needs to synthe
size a default constructor for classes that declare no constructor at all. T
he Standard refers to these as implicit, nontrivial default constructors. Th
e synthesized constructor fulfills only an implementation need. It does this
by i
【在 c*******9 的大作中提到】 : so the default construct are empty since there are no data member?
|
B*******g 发帖数: 1593 | 6 这段话是针对某些情况下的derived class说的吧?
Constructor,
Class wi
synthe
all. T
constructors. Th
does this
initializin
object. Clas
【在 j***i 的大作中提到】 : 这个情况不需要把 : From inside C++ obj model : There are four characteristics(Member Class Object with Default Constructor, : Base Class with Default Constructor,Class with a Virtual Function, Class wi : th a Virtual Base Class) of a class under which the compiler needs to synthe : size a default constructor for classes that declare no constructor at all. T : he Standard refers to these as implicit, nontrivial default constructors. Th : e synthesized constructor fulfills only an implementation need. It does this : by i
|
j***i 发帖数: 1278 | 7 不是,genreal case ,
【在 B*******g 的大作中提到】 : 这段话是针对某些情况下的derived class说的吧? : : Constructor, : Class wi : synthe : all. T : constructors. Th : does this : initializin : object. Clas
|
B*******g 发帖数: 1593 | 8 哦 我之前读错了
虽然他说
Clas
ses that do not exhibit these characteristics and that declare no
constructo
r at all are said to have implicit, trivial default constructors. In
practic
e, these trivial default constructors are not synthesized.
那照他的意思所有POD class 都没有default constructor了?
【在 j***i 的大作中提到】 : 不是,genreal case ,
|
c*******t 发帖数: 13 | 9 常见的编译器都是这么干的,对更一般的POD aggregate class也是如此
【在 B*******g 的大作中提到】 : 哦 我之前读错了 : 虽然他说 : Clas : ses that do not exhibit these characteristics and that declare no : constructo : r at all are said to have implicit, trivial default constructors. In : practic : e, these trivial default constructors are not synthesized. : 那照他的意思所有POD class 都没有default constructor了?
|
h*****0 发帖数: 4889 | 10 ctor肯定是存在的,只不过不干事而已。你还是可以调用的。
Constructor,
wi
synthe
T
Th
this
initializin
Clas
【在 j***i 的大作中提到】 : 这个情况不需要把 : From inside C++ obj model : There are four characteristics(Member Class Object with Default Constructor, : Base Class with Default Constructor,Class with a Virtual Function, Class wi : th a Virtual Base Class) of a class under which the compiler needs to synthe : size a default constructor for classes that declare no constructor at all. T : he Standard refers to these as implicit, nontrivial default constructors. Th : e synthesized constructor fulfills only an implementation need. It does this : by i
|
P********e 发帖数: 2610 | 11 今天刚看了,更正一下
这种叫trivial ctor,通常情况下是不产生的
前面有人说贴了,4种特性是nontrivial的default ctor,干很多事。是一定有的
【在 h*****0 的大作中提到】 : ctor肯定是存在的,只不过不干事而已。你还是可以调用的。 : : Constructor, : wi : synthe : T : Th : this : initializin : Clas
|