是的,您可以,但是它受规则的限制,您的getter/setter不能具有比属性本身更少限制的访问修饰符.
例如(C#):
public Foo { get; private set; } //this is okay
protected Bar { get; public set; } //this will throw a compile error
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4024 次 |
| 最近记录: |