Delphi Error – E2264 Cannot have method resolutions for interface ‘%s’

Delphi Compiler Error

E2264 Cannot have method resolutions for interface ‘%s’

Reason for the Error & Solution

An attempt has been made to use a method resolution clause for an interface named in an implements clause.

program Produce;
type
  I0 = interface
    procedure i0p0(a : char);
  end;

  T0 = class(TInterfacedObject, I0)
    procedure I0.i0p0 = proc0;
    function getter : I0;
    procedure proc0(a : char);
    property p0 : I0 read getter implements I0;
  end;

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

function T0.getter : I0;
begin
end;
end.


In this example, the method proc0 is mapped onto the interface procedure i0p0, but because the interface is mentioned in a implements clause, this renaming is not allowed.

program Solve;
type
  I0 = interface
    procedure i0p0(a : char);
  end;

  T0 = class(TInterfacedObject, I0)
    function getter : I0;
    procedure i0p0(a : char);
    property p0 : I0 read getter implements I0;
  end;

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

function T0.getter : I0;
begin
end;
end.


The solution for this error is to remove the offending “name resolution clause”. One easy way to accomplish this is to name the procedure in the class to the same name as the interface method.

Share:

Leave A Reply

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

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...