E2508 type parameters not allowed on this type (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

When using class references, you cannot use generic classes directly. You need to use a wrapper class to be able to use generics.


program E2508;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  TMyClass = class
  end;
  TMyClassClass<T> = class of TMyClass;

begin
   Writeln('FAIL - E2508 type parameters not allowed on this type');
end.