Inherited

From Lazarus wiki
Revision as of 12:15, 21 February 2016 by BrainChemistry (talk | contribs) (brief description of inherited according to fp documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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;