BasModule



Option Explicit
'This module keeps track of the static object pointer and

Private m_Object As SingletonImpl
Private refCount As Integer

Public Function ReleaseRef() As Integer
refCount = refCount - 1
If refCount <= 0 Then Set m_Object = Nothing
End Function

Public Function GetReference() As Singleton
If refCount = 0 Then Set m_Object = New SingletonImpl
refCount = refCount + 1
Set GetReference = m_Object
End Function

(basmodule.html)- by Paolo Puglisi - Modifica del 25/3/2019