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 |