[Lazarus] inherited in autocode
Martin Frb
lazarus at mfriebe.de
Sat Jan 12 23:45:19 CET 2019
On 12/01/2019 22:54, Martok via lazarus wrote:
> Am 12.01.2019 um 22:28 schrieb Martin Frb via lazarus:
>> Same for constructors, if the parent constructor changes its argument
>> list, it will no longer be called.
> It does generate code, but it calls *any* inherited constructor that matches the
> signature:
>
> type
> TA = class
> constructor Create(extra:Boolean);
> end;
> TB = class(TA)
> constructor Create;
> end;
>
> constructor TA.Create(extra: Boolean);
> begin
> inherited Create;
> WriteLn('TA.Create');
> end;
> constructor TB.Create;
> begin
> inherited; // calls TObject.Create!
because TObject has a matching constructor.
Imagine it was
constructor TB.Create(extra: integer);
but was changed it TA.
More information about the lazarus
mailing list