| 名称 | Singleton |
| 结构 | |
| 意图 | 保证一个类仅有一个实例,并提供一个访问它的全局访问点。 |
| 适用性 |
|
1
// Singleton
2
3
// Intent: "Ensure a class only has one instance, and provide a global
4
// point of access to it".
5
6
// For further information, read "Design Patterns", p127, Gamma et al.,
7
// Addison-Wesley, ISBN:0-201-63361-2
8
9
2
3
4
5
6
7
8
9