使用工厂来判断逻辑中传递给工厂的参数,然后在工厂里面创建对应的对象,而不需要直接new对象,通过传值来让工厂new对象.
需要多看代码形成瞬时反应来判断工厂的设计模式
更加详见:https://www.runoob.com/design-pattern/factory-pattern.html