EmptyClass
{
};
之前看书说这看起来什么都没有,其实编译器还是会为你做点事情的,像给它构造\析构函数什么的。饿 这是必须滴!
其他的呢??
int main()
{
EmptyCls eptCls1;
EmptyCls eptCls2;
EmptyCls* ptrEptCls3 = &eptCls1; //operator &
EmptyCls eptCls6 = *ptrEptCls3; //operator *
EmptyCls eptCls4 = eptCls1; //operator =EmptyCls eptCls5(eptCls2); //拷贝构造
getchar();
return 0;
}
eptCls1.operator&();//error
eptCls1.operator*();//error
当我写出来那两句红色代码的时候,我就给自己挖了个坑。
>综上:1.构造函数。2.析构函数。3.拷贝构造函数。4.拷贝赋值函数。