Inherited

From Free Pascal wiki
Revision as of 22:16, 3 November 2016 by E-ric (talk | contribs)
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;