关于delete this
大脚板 2004-03-24 08:43:25 看到ACE中有delete this中的用法,有所不解
class B
{
public:
bool show(void)
{
OutputDebugString("show");
return true;
}
void del(void)
{
OutputDebugString("delete 1");
delete this;
OutputDebugString("delete 2");
}
};
int _tmain(int argc, _TCHAR* argv[])
{
B* b=new B;
b->show();
b->del();
b->show();
system("PAUSE");
return 0;
}
虽然上边的代码能运行,但delete this好象并没有起作用
求教