Changes

Jump to: navigation, search

Singleton

321 bytes added, 18:16, 8 March 2007
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;
}
}
1
edit

Navigation menu