Inherited

From Free Pascal wiki
Jump to: navigation, search

Deutsch (de) English (en) français (fr)


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;