S
sun2000
Unregistered / Unconfirmed
GUEST, unregistred user!
有如下的类定义,为什么会对Parent::~Parent()调用三次??????
class TParent
{
public:
TParent() {}
virtual __fastcall ~TParent()
{ ShowMessage("TParent Destructor");
}
};
class TChild: public TParent
{
public:
TChild(): TParent() {}
vitual __fastcall ~TChild()
{ ShowMessage("TChild Destructor");
}
};
int main(void)
{
TParent *Parent = new TParent();
TChild *Child = new TChild();
FreeObjects(Parent);
FreeObjects(Child);
}
class TParent
{
public:
TParent() {}
virtual __fastcall ~TParent()
{ ShowMessage("TParent Destructor");
}
};
class TChild: public TParent
{
public:
TChild(): TParent() {}
vitual __fastcall ~TChild()
{ ShowMessage("TChild Destructor");
}
};
int main(void)
{
TParent *Parent = new TParent();
TChild *Child = new TChild();
FreeObjects(Parent);
FreeObjects(Child);
}