E2177 コンストラクタまたはデストラクタを OLE オートメーション部に置くことはできません (Delphi)

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

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

クラス宣言の automated 部の中へコンストラクタかデストラクタを誤って入れようとしました。


program Produce;

  type
    Base = class
    automated
      constructor HardHatBob;
      destructor  DemolitionBob;
    end;

  constructor Base.HardHatBob;
  begin
  end;

  destructor Base.DemolitionBob;
  begin
  end;

begin
end.

{ OLE オートメーション部の中ではクラスのコンストラクタやデストラクタを宣言できない。このコードのコンストラクタ宣言とデストラクタ宣言はどちらもこのエラーを生成する }


program Solve;

  type
    Base = class
      constructor HardHatBob;
      destructor  DemolitionBob;
    end;

  constructor Base.HardHatBob;
  begin
  end;

  destructor Base.DemolitionBob;
  begin
  end;

begin
end.

{ このコードに示すように,宣言を automated 部の外へ出すのがこのエラーのただ 1 つの解決方法である }