Skip to content

Commit

Permalink
更新设计模式readme
Browse files Browse the repository at this point in the history
  • Loading branch information
MidnightDancing committed Aug 2, 2019
1 parent b8fc5a6 commit b936497
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions pattern/prototype.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,4 @@ public class Client {
## 什么时候可以派上用场
> - 创建新对象成本较大(如初始化需要占用较长的时间,占用太多的CPU资源或网络资源),新的对象可以通过原型模式对已有对象进行复制来获得,如果是相似对象,则可以对其成员变量稍作修改。
> - 可以使用深克隆的方式保存对象的状态,使用原型模式将对象复制一份并将其状态保存起来,以便在需要的时候使用(如恢复到某一历史状态),可辅助实现撤销操作
> - 需要避免使用分层次的工厂类来创建分层次的对象,并且类的实例对象只有一个或很少的几个组合状态,通过复制原型对象得到新实例可能比使用构造函数创建一个新实例更加方便。

0 comments on commit b936497

Please sign in to comment.