Delphi Error – E2252 Method ‘%s’ with identical parameters already exists

Delphi Compiler Error

E2252 Method ‘%s’ with identical parameters already exists

Reason for the Error & Solution

A method with an identical signature already exists in the data type.

program Produce;

  type
    t0 = class
      procedure f0(a : integer); overload;
      procedure f0(a : integer); overload;
    end;

procedure T0.f0(a : integer);
begin
end;

begin
end.


The error is produced here because there are two overloaded declarations for the same procedure.

program Solve;

  type
    t0 = class
      procedure f0(a : integer); overload;
      procedure f0(a : char); overload;
    end;

procedure T0.f0(a : integer);
begin
end;

procedure T0.f0(a : char);
begin
end;

begin
end.


There are different approaches to resolving this error. One approach is to remove the redundant declaration of the procedure. Another approach, taken here, is to change the parameter type of the duplicate declarations so that it creates a unique version of the overloaded procedure.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...