Delphi Error – E2563 Specified interface type is not declared

Delphi Compiler Error

E2563 Specified interface type is not declared

Reason for the Error & Solution

This occurs when you define an interface and in the inheritance you use different type restrictions between the inheritance expression and the methods you implement.

program E2563;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  IMyIntf<T> = interface
    procedure IProc(A: T);
  end;

  TClass = class(TInterfacedObject, IMyIntf<String>) //E2563
    procedure IMyIntf<Integer>.IProc; //E2563  ImyIntf<Integer> not defined 
                                             // You should use either String or, in the inheritance expression, use class(TInterfacedObject, IMyIntf<Integer>)
  end;

begin

end.

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...