Search code examples
delphiinherited

Is inherited keyword called automatically in Delphi?


According to this page

http://www.delphibasics.co.uk/RTL.asp?Name=Inherited

It says "It is called at the start of a constructor, and at the end of a desctructor. It is not mandatory, but recommended as good practice. "

Did I not understand correctly this? Does it mean that we don't need to put 'inherited' in constructor or destructor because it will be automatically inserted by compiler?


Solution

  • No, inherited isn't called automatically; you have to do it yourself (if you want to call the inherited procedure, which you normally do). And you can even choose when to do it, see, e.g., this answer. Typically you do it at the beginning of a constructor, and at the end of a destructor.