J
Jeremy Cowles
Will the keyword "Me" ever be able to be the target of an assignment?
Because singleton classes would be MUCH simplier if you could just point Me
to a different address. For example:
Class SingletonClassic
Private Shared sm_Instance as SingletonClassic
Public Shared Sub GetInstance()
Return sm_Instance
End Sub
End Class
Class SingletonNew
Private Shared sm_Instance as SingletonClassic
Sub New
If not sm_Instance is Nothing then
me = sm_instance
return
End If
End Sub
End Class
Usage (classic):
Dim sc as SingletonClassic
sc = sc.GetInstance( )
Usage (new):
Dim sn as New SingletonNew( )
isnt the second much nicer? You could totally hide the fact that your class
only has one instance...
~
Jeremy
Because singleton classes would be MUCH simplier if you could just point Me
to a different address. For example:
Class SingletonClassic
Private Shared sm_Instance as SingletonClassic
Public Shared Sub GetInstance()
Return sm_Instance
End Sub
End Class
Class SingletonNew
Private Shared sm_Instance as SingletonClassic
Sub New
If not sm_Instance is Nothing then
me = sm_instance
return
End If
End Sub
End Class
Usage (classic):
Dim sc as SingletonClassic
sc = sc.GetInstance( )
Usage (new):
Dim sn as New SingletonNew( )
isnt the second much nicer? You could totally hide the fact that your class
only has one instance...
~
Jeremy