Should overload work for the following?
Upon seeing the method being overloaded, if (in the class hierarchy) no method  with matching signature is found, should procedures outside the class be searched? > project1.lpr(19,8) Error: Incompatible type for arg no. 1: Got "ShortInt", expected "Boolean"

In the below example, I could write "project1.Foo(1); ". But if I had various "Foo" in various included units, then it would be inconvenient to always have to find the correct unit myself.

The doc https://www.freepascal.org/docs-html/ref/refsu86.html does not contain any references to classes. It only refers to cross unit.


program Project1;
{$mode objfpc}{$H+}

procedure Foo(a: integer); forward; overload;

type
  TBar = class
  public
    procedure Foo(a: boolean); overload;
    procedure Bar;
  end;

procedure TBar.Foo(a: boolean);
begin
end;

procedure TBar.Bar;
begin
  Foo(1); //project1.lpr(19,8) Error: Incompatible type for arg no. 1: Got "ShortInt", expected "Boolean"
end;

procedure Foo(a: integer);
begin
end;

begin
end.

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to