Home > Back-end >  Inherit the class TObject won't call operate new
Inherit the class TObject won't call operate new

Time:10-03

Defines a class
The class TCfgDisplay: public TObject
{
Public:
__fastcall TCfgDisplay ();
__fastcall ~ TCfgDisplay ();
Void * operator new (size_t AReqSize);
Void operator delete (void * ADoomed, size_t ASize);
};

TCfgDisplay * ICfgDisplay=new TCfgDisplay ();
Not to call the custom of the new method
The same delete ICfgDisplay;
Won't go to call the custom of the delete method, this is why.
If you remove inheritance, is possible.

CodePudding user response:

Void * operator new (size_t AReqSize);
Void operator delete (void * ADoomed, size_t ASize);

These two functions and the system of new and delete the same reason?
  • Related