Difference between revisions of "Inherited"
From Lazarus wiki
Jump to navigationJump to search (brief description of inherited according to fp documentation) |
|
(No difference)
|
Revision as of 21:52, 21 February 2016
│
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;