C
Codemonkey
Just a silly question, but why can't you overload a writeonly property with
a readonly one? Surely the compiler can tell the difference of which one to
call at compile time, depending on if it is an assignment or a get?
I know there isn't much point to this anyway, but until Properties with
different scope for Get and Set methods are brought back (as asked by George
in a previous post about "properties with different scope", it would have
been nice to do the following:
--------------------------
Private mName As String
Public ReadOnly Property Name() As String
Get
Return mName
End Get
End Property
Protected Friend WriteOnly Property Name() As String
Set(ByVal Value As String)
mName = Value
End Set
End Property
--------------------
Saying that, it would be nicer to do this (as George and numerous others
mentioned):
-----------------------------
Private mName As String
Public Property Name() As String
Public Get
Return mName
End Get
Protected Friend Set(ByVal Value As String)
mName = Value
End Set
End Property
----------------------------
a readonly one? Surely the compiler can tell the difference of which one to
call at compile time, depending on if it is an assignment or a get?
I know there isn't much point to this anyway, but until Properties with
different scope for Get and Set methods are brought back (as asked by George
in a previous post about "properties with different scope", it would have
been nice to do the following:
--------------------------
Private mName As String
Public ReadOnly Property Name() As String
Get
Return mName
End Get
End Property
Protected Friend WriteOnly Property Name() As String
Set(ByVal Value As String)
mName = Value
End Set
End Property
--------------------
Saying that, it would be nicer to do this (as George and numerous others
mentioned):
-----------------------------
Private mName As String
Public Property Name() As String
Public Get
Return mName
End Get
Protected Friend Set(ByVal Value As String)
mName = Value
End Set
End Property
----------------------------