Results 1 to 3 of 3

Thread: Is it necessary to call inherited Create/Destroy?

  1. #1

    Is it necessary to call inherited Create/Destroy?

    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?
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  2. #2

    Is it necessary to call inherited Create/Destroy?

    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..
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  3. #3

    Is it necessary to call inherited Create/Destroy?

    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.
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •