首先,
类内有六个默认的函数:
1、构造函数2、拷贝构造3、析构函数4、赋值语句5、取值运算符6、取常地址运算符
然后,为了解释好下面的一些小知识点要先创建一个TEST类,如下。
class Test
{
public:
Test(int d = 0) : data(d)
{
cout<<"Create Obj : "<<this<<endl;
}
Test(const Test &t)
{
cout<<"Copy Create Obj : "<<this<<endl;
data = t.data;
}
//t2 = t1;
Test& operator=(const Test &t)
{
cout<<"Assign:"<<this<<" = "<<&t<<endl;
if(this != &am