[fpc-pascal] Helper/function overloads

Michael Van Canneyt michael at freepascal.org
Thu Apr 11 12:16:12 CEST 2019



On Wed, 10 Apr 2019, Ryan Joseph wrote:

> Is this a bug or intended behavior? I can call it like Test.DoThis but it seems like overloading should work.
>
> {$mode objfpc}
> program test;
>
> type
>  THelper = class helper for TObject
>    procedure DoThis; overload;
>  end;
>
> procedure DoThis (param: string); overload;
> begin
> end;
>
> procedure THelper.DoThis;
> begin
>  DoThis('string'); // <——— ERROR: Wrong number of parameters specified for call to "DoThis"
> end;
>
> begin
> end.

As far as I know, in a method "overload" only means it checks higher up the inheritance
chain. Delphi gives the same error.

Michael.


More information about the fpc-pascal mailing list