E2515 Type parameter '%s' is not compatible with type '%s' (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

This occurs when the type restraint object type is not a concrete type.


program E2515;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  TMyConcreteClass = class
  end;

type
  TMyData<T: TMyConcreteClass> = class(TObject)
  end;
var
  mustBeConcreteType: TMyData<TObject>; //E2515 Fix: construct a class that wraps the TObject class and inherits its methods.

begin
   Writeln('E2515 Type parameter ''%s'' is not compatible with type ''%s''');
end.