[Lazarus] inherited in autocode

Martok listbox at martoks-place.de
Sat Jan 12 22:54:59 CET 2019


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!
    WriteLn('TB.Create');
  end;


> That is indented behaviour and apparently Delphi compatible.
Delphi 2007 fails compilation with "Incompatible Types" when no compatible
method of the same name exists, which makes sense.


-- 
Regards,
Martok



More information about the lazarus mailing list