[fpc-pascal] Helper/function overloads

Anthony Walter sysrpl at gmail.com
Fri Apr 12 13:56:46 CEST 2019


I'm not sure if this is anything you're interested in but ...

You can qualify the of the procedure with the unit or program identifier.

program Test;

{$mode objfpc}

type
  THelper = class helper for TObject
    procedure DoThis;
  end;

procedure DoThis(Param: string);
begin
  WriteLn(Param);
end;

procedure THelper.DoThis;
begin
  Test.DoThis('Hello World');
end;

var
  Obj: TObject;
begin
  Obj := TObject.Create;
  try
    Obj.DoThis;
  finally
    Obj.Free;
  end;
end.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190412/95e3c36d/attachment.html>


More information about the fpc-pascal mailing list