【C++题目001】类的哪些部分不是由编译器自动生成的

Which of the following is not automatically generated by the compiler?
a) default constructor
b) copy constructor
c)equality operator (op==)
d) assignment operator (op=)
e) destructor

#include <iostream>
#include <string>
#include <assert.h>
using namespace std;

class A
{

};
int _tmain(int argc, _TCHAR* argv[])
{
	A a; //有默认构造函数
	A b(a); //有默认拷贝构造函数
	A c = b; //有默认赋值操作
	A * d = new A;
	delete d; // 有默认析构函数

	assert(a == b); //没有默认equality operator
	return 0;
}

 

posted on 2011-06-04 15:52  speedmancs  阅读(194)  评论(0编辑  收藏  举报

导航