69,382
社区成员
发帖
与我相关
我的任务
分享
class A
{
public:
A()
{
p=this;
}
~A()
{
if(p!=NULL)
{
delete p; p=NULL;
}
}
A* p;
};
class A
{
public:
A()
{
p=this;
}
~A()
{
if(p!=this) // this应该由delete销毁
{
delete p; p=NULL;
}
}
A* p;
};
太绕了。