1
edit
Changes
no edit summary
==UML Diagram==
[[Image:Singleton_UML.png]]
==Sample Code==
class Singleton
{
private static Singleton instance;
// Note: Constructor is 'protected'
protected Singleton()
{
}
public static Singleton Instance()
{
// Use 'Lazy initialization'
if (instance == null)
{
instance = new Singleton();
}
return instance;
}
}