Inherited

From Free Pascal wiki
Revision as of 21:52, 21 February 2016 by FTurtle (talk | contribs) (FTurtle moved page inherited to Inherited: for maintaining proper naming)
Jump to navigationJump to search

Deutsch (de) English (en) suomi (fi) français (fr) русский (ru)


In an overridden virtual method, it is often necessary to call the parent class’ implementation of the virtual method. This can be done with the inherited keyword. Likewise, the inherited keyword can be used to call any method of the parent class.

This case is the simplest:

Type  
  TMyClass = Class(TComponent)  
    Constructor Create(AOwner : TComponent); override;  
  end; 

Constructor TMyClass.Create(AOwner : TComponent);  
begin  
  Inherited;  
  // Do more things  
end;