摘要:
简单工厂模式违背了开闭原则,扩张性不好 工厂方法模式 :有需求就去创建工厂新工厂继承工厂类这样避免修改其他工厂 把操作对象改变成操作各自的工厂 阅读全文
posted @ 2019-04-21 23:26
1点
阅读(140)
评论(0)
推荐(0)
摘要:
简单工厂模式由一个工厂对象决定创建出哪一种产品类的实例 缺点: 1. 耦合 2.依赖具体的实现 class Animal { constructor(name) { this.name=name; } eat() { console.log('吃什么呀') } } class Dog extends 阅读全文
posted @ 2019-04-21 21:40
1点
阅读(106)
评论(0)
推荐(0)

浙公网安备 33010602011771号