E2515 型パラメータ '%s' は型 '%s' と互換性がありません(Delphi)

提供: RAD Studio
移動先: 案内検索

エラーと警告のメッセージ(Delphi) への移動


このエラーは、型制約オブジェクト型が具象型でないときに発生します。


 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.