E2181 プロパティの再宣言は OLE オートメーション部ではできません (Delphi)
エラーと警告のメッセージ(Delphi) への移動
automated 部の中ではプロパティを再宣言できません。
program Produce; type Base = class v : Integer; s : String; protected property Name : String read s write s; property Value : Integer read v write v; end; Derived = class (Base) public property Name; (* 再宣言により,Name の可視性を public に変更 *) automated property Value; end; begin end.
{ このコードでは,再宣言によって Base での Name の可視性を private から public へ変更した。同じ操作を Value に試みたがエラーになった }
program Solve; type Base = class v : Integer; s : String; protected property Name : String read s write s; property Value : Integer read v write v; end; Derived = class (Base) public property Name; (* 再宣言により,Name の可視性を public に変更 *) property Value; automated end; begin end.
{ プロパティの可視性を automated 部へは変更できない。したがって,基本クラスのプロパティを automated 部で再宣言しないのがこの問題の解決方法である }