The following code throws me the compiler error
E2252 Method 'MyFunction' with identical parameters already exists
program Project3;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
type
aMyInterface = interface
function MyFunction(const aSort: Integer; var aEndPoint: Integer): Integer; overload;
function MyFunction(const aSort, aStartingPoint: Integer): Integer; overload;
end;
aMyClass = class(TInterfacedObject, aMyInterface)
function MyFunction(const aSort: Integer; var aEndPoint: Integer): Integer; overload;
function MyFunction(const aSort, aStartingPoint: Integer): Integer; overload;
end;
{ aMyClass }
function aMyClass.MyFunction(const aSort: Integer; var aEndPoint: Integer): Integer;
begin
Result := 1;
end;
function aMyClass.MyFunction(const aSort, aStartingPoint: Integer): Integer;
begin
Result := 1;
end;
begin
end.
I understand there are two variables Integer type for each instance of the function but in one function both variables are both const and in the other function one variable one is const and the other one is var.
Why isn't that sufficient not to be considered identical parameters?