我使用Borland C++ Builder。C++中的析構函數和繼承?
,我不得不O問題
#include <Classes.hpp>
class TMyObject : public TObject
{
__fastcall TMyObject();
__fastcall ~TMyObject();//I would like to inherite my destructor from TObject
};
__fastcall TMyObject::TMyObject() : TObject()//it will inherited my constructor from TObject
{
}
而對於新的析構函數將inherite ~TObject
?
__fastcall TMyObject::~TMyObject?????????????
'TObject'是Borland提供的系統類,它有一個虛擬析構函數。 –
好的!所以這裏不應該有任何問題:〜TMyObject()和〜TObject()應該被調用,而不需要我們做任何特定的事情。 – Shlublu
正確,它確實像預期的那樣工作。 –