E2257 インターフェース '%s' の implements 節が複数定義されました (Delphi)

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

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

同じインターフェースを実装しようとしている 2 つの異なるプロパティ宣言があります。1 つのインターフェースは 1 つのプロパティで実装します。


program Produce;
type
  IMyInterface = interface
  end;

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


{ Myinterface と OtherInterface の両方が IMyInterface を実装しようとしている。1 つのプロパティだけがそのインターフェースを実装できる }

{ 唯一の解決策は,競合しているどちらかの implements 節を削除すること }