Skip to content

Commit

Permalink
[IM]: 简单工厂模式
Browse files Browse the repository at this point in the history
  • Loading branch information
liujj committed Jun 28, 2022
1 parent d1c114f commit 4f34e3a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions 02.c++笔记/16.C++设计模式.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,22 @@ int main() {
# 简单工厂模式
## 1.优点
1.客户端和具体实现类解耦
2.对于某些对象创建过程比较复杂的情况,我们不需要考虑
## 2.缺点
1.简单工厂模式,增加新的功能需要修改源代码,不符合开闭原则
2.这个类的职责过重,这个类发生问题,会影响很多使用这个工厂的模块
# 创建者模型
Expand Down

0 comments on commit 4f34e3a

Please sign in to comment.