从概念上讲,似乎派生类应该能够使用读写属性覆盖readonly属性.为什么这不可能? Public Class Base Protected _name As String Public Overridable ReadOnly Property Name() As String Get return _name End Get End Proper
Public Class Base Protected _name As String Public Overridable ReadOnly Property Name() As String Get return _name End Get End Property End Class Public Class Derived Inherits Base Public Overrides Property Name() As String Get Return MyBase.Name End Get Set(ByVal value As String) _name = value End Set End Property End Class我认为这清楚地解释了它.
Why is it impossible to override a getter-only property and add a setter?