E2265 インターフェース %s がインターフェースリストにありません (Delphi)

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

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

クラスのインターフェースリストにないインターフェースを implements 節が参照しています。


program Produce;
type
  IMyInterface = interface
  end;

  TMyClass = class(TInterfacedObject, IUnknown)
    FMyInterface: IMyInterface;
    property MyInterface: IMyInterface read FMyInterface implements IMyInterface;
  end;
end.


{ この例では IMyInterface インターフェースに対して implements を使用しているが,このインターフェースはインターフェースリストにない }


program Solve;
type
  IMyInterface = interface
  end;

  TMyClass = class(TInterfacedObject, IUnknown, IMyInterface)
    FMyInterface: IMyInterface;
    property MyInterface: IMyInterface read FMyInterface implements IMyInterface;
  end;
end.


{ 簡単な解決策は,必要なインターフェースをクラス定義のインターフェースリストに追加することである。インターフェースリストにインターフェースを追加するためには,そのインターフェースのメソッドを実装しなければならない }