是否可以将属性的读/写具有不同的可见性?

Ken*_*ssa 8 delphi language-features

正如问题所说......是否可以在不同的可见性水平上声明属性的读/写.如果是这样,语法是什么?

沿线的东西:

  protected
    property MyProp : Integer write FMyProp;
  public
    property MyProp : Integer read FMyProp;
  end;
Run Code Online (Sandbox Code Playgroud)

并不是说它是一个主要的语言功能,它很容易被替换

protected
  procedure SetMyProp(Value : Integer);
public
  property MyProp : Integer read FMyProp;
end;
Run Code Online (Sandbox Code Playgroud)

如果存在这样的可能性,我只是好奇.

Ond*_*lle 8

不,您必须将其拆分为两个单独的属性(具有不同的名称),尽管它们可以引用相同的私有字段.