I have a class in vb.net like
Public Class Customer
Private _Name As String
Public Overridable Property Name() As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
End Class
and a class deriving from it
Public Class ProxyCustomer
Inherits Customer
Private _name As String
Public Overrides WriteOnly Property Name() As String
Set(ByVal value As String)
_name = value
End Set
End Property
End Class
which gives me following error Public Overrides WriteOnly Property Name() As String' cannot override 'Public Overridable Property Name() As String' because they differ by 'ReadOnly' or 'WriteOnly'
but i have same construct in C#
public class Customer
{
public virtual string FirstName { get; set; }
}
public class CustomerProxy:Customer {
public override string FirstName
{
set
{
base.FirstName = value;
}
}
}
which works, so the first thing is , is this consistent because 2 languages are behaving in a very inconsistent way.
secondly, when i do a reflection to get a property, so for example
Dim propInfo = GetType(Customer).GetProperty("Name")
the propINfo.canRead property is always false, shouldn't this be true since base class implements the getter of the property ?
many thanks