PDA

View Full Version : Is it necessary to call inherited Create/Destroy?



Useless Hacker
27-11-2003, 05:51 PM
If I have a class descending directly from TObject, is it necessary for the constructor and destructor to call the inherited methods, since as far as I know they do not actually do anything?

M109uk
27-11-2003, 06:33 PM
No, i shouldnt think you need to. The constructor and destructor for TObject are empty so i wont make any difference if you called it or not..

Alimonster
02-12-2003, 12:44 AM
Yep, the base constructor and destructor for TObject don't do anything. However, I'd advise you to include an "inherited" for the sake of consistency -- you may decide to derive them from another common base class at some point (e.g. "TGenericGameObject" or whatever), at which point you may end up forgetting to call its constructor or destructor due to missing inherited...

Keep in mind that you can always remove the calls once you've finished the game.