vb.net - Is it possible to override the creation of a new object and return an existing object? -


So a quick non-working example of what I'm trying to do:

  Public class repclass repclass as public share in the form of public N. as new public (new as integer) If there is no representative then then 'me existing thing like me = delegate' or return representative 'N = N rep = I end if end sub end class  

is it possible And is it?

I think what you are looking for is the singleton design pattern which ensures that only the class There is an example. See . Here is a converted example in VB:

  Public Class Singleton Private Shared m_instance Singleton Private Sub New () and Sub-Public Shared Readline Property Instances () Get Singleton as Android If M_Vance is Nothing Then m_instance = new singleton () and return m_instance end end and protection and class  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -