1 class Singleton
2 {
3 private static Singleton instance;
4
5 // Note: Constructor is 'protected'
6 protected Singleton()
7 {
8 }
9
10 public static Singleton Instance()
11 {
12 // Use 'Lazy initialization'
13 if (instance == null)
14 {
15 instance = new Singleton();
16 }
17
18 return instance;
19 }
20 }
21