Update 03. 使用私有构造方法或枚类实现Singleton属性.md

This commit is contained in:
Joe 2019-02-27 11:56:04 +08:00 committed by GitHub
parent c2e2b0eba1
commit a0c1bc119e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
# 3. 使用私有构造方法或枚类实现 Singleton 属性
---
  单例是一个仅实例化一次的类[Gamma95]。单例对象通常表示无状态对象,如函数 (条目 24) 或一个本质上唯一的系统组件。让一个类成为单例会使测试它的客户变得困难,因为除非实现一个作为它类型的接口,否则不可能用一个模拟实现替代单例。