RAD Studio Athens

E2181

Go Up to Error and Warning Messages (Delphi)

It is not allowed to move the visibility of a property into an automated section.


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; (* Move Name to a public visibility by redeclaration *)
    automated
      property Value;
    end;

begin
end.

In the above example, Name is moved from a private visibility in Base to public visibility in Derived by redeclaration. The same idea is attempted on Value, but an error results.


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; (* Move Name to a public visibility by redeclaration *)
      property Value;
    automated
    end;

begin
end.

It is not possible to change the visibility of a property to an automated section, therefore the solution to this problem is to not redeclare properties of base classes in automated sections.