This mode is very simple, only listed in the following code:
Class Singletonclass
{
Private:
Static Singletonclass * Singleton;
Private:
Singletonclass ()
{}
PUBLIC:
Static Singletonclass * getInstance ();
}
Singletonclass :: Singleton = NULL;
Singletonclass * singletonclass :: getInstance ()
{
IF (Singleton == Null)
Singleton = new singleletonclass ();
Return Singleton;
}