由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - C++ Q06: POD versus Aggregate-type
相关主题
a question about const reference这个c++ static var 很有意思
C++ Template Questionwhat is the difference?
C++弱问C & C++ mixing question
G++用-g和-O3编译运行结果竟然不一样一个 default constructor 的问题
请教一下,exception时,destructor一定会被调用么?const object
谁给总结一个c++变量初始化的规律?关于C/C++里的Static variable的memory allocation/initializa
c++ questionWhat does the default constructor do?
再问C++初始化问题。几个C++书写风格疑问
相关话题的讨论汇总
话题: pod话题: aggregate话题: q06话题: c++
进入Programming版参与讨论
1 (共1页)
c**********e
发帖数: 2007
1
class A {
public:
~A() {}
int a; int b;
}
Which statement about the sample code above is correct?
a) It is an aggregate, but not a POD (Plain Old Datatype).
b) It is just a POD.
c) It is both a POD and an aggregate.
d) It cannot be initialized because there are no constructors.
e) It cannot be initialized as an array element because there is no default
constructor.
E*U
发帖数: 2028
2
a

【在 c**********e 的大作中提到】
: class A {
: public:
: ~A() {}
: int a; int b;
: }
: Which statement about the sample code above is correct?
: a) It is an aggregate, but not a POD (Plain Old Datatype).
: b) It is just a POD.
: c) It is both a POD and an aggregate.
: d) It cannot be initialized because there are no constructors.

c**********e
发帖数: 2007
3
You are right!
A POD is always an aggregate. A POD can not have user defined destructor or
user-defined copy assignment operator.

【在 E*U 的大作中提到】
: a
1 (共1页)
进入Programming版参与讨论
相关主题
几个C++书写风格疑问请教一下,exception时,destructor一定会被调用么?
Java的POD比C++干净很多谁给总结一个c++变量初始化的规律?
顶这锅盖总结:Java/C#萨克斯,只有C/C++才是真正的low latencyc++ question
Doxygen怎么产生C++ Aggregation关系的UML图呢再问C++初始化问题。
a question about const reference这个c++ static var 很有意思
C++ Template Questionwhat is the difference?
C++弱问C & C++ mixing question
G++用-g和-O3编译运行结果竟然不一样一个 default constructor 的问题
相关话题的讨论汇总
话题: pod话题: aggregate话题: q06话题: c++