由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - c++ question
相关主题
问个copy constructor的问题C++ 中 myobject * a =new myobject[n] 的问题
const objectSynthesized Constructor到底什么意思?
What does the default constructor do?一道c++的考古题
请教几个C++问题回答C++的弱问题
what is the difference?[合集] C++的弱问题
问个题。急问:compile and build dependency
问个c++问题find bugs of c++ codes
[合集] 又学了一招C++ question
相关话题的讨论汇总
话题: class话题: default话题: generated
进入Programming版参与讨论
1 (共1页)
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

1 (共1页)
进入Programming版参与讨论
相关主题
C++ questionwhat is the difference?
一个c++ constructor的问题, thanks问个题。
问一个 copy constructor 的问题 (C++)问个c++问题
C++ 问题[合集] 又学了一招
问个copy constructor的问题C++ 中 myobject * a =new myobject[n] 的问题
const objectSynthesized Constructor到底什么意思?
What does the default constructor do?一道c++的考古题
请教几个C++问题回答C++的弱问题
相关话题的讨论汇总
话题: class话题: default话题: generated