【发布时间】:2012-02-26 19:26:56
【问题描述】:
可能重复:
What are the practical uses of Factory Method Pattern?
Differences between Abstract Factory Pattern and Factory Method
我目前对工厂的理解是它可以通过输入字符串来创建对象,比如说
Factory.create("mouse");
Factory.create("hamster");
这种模式与新模式相比有什么优势?
【问题讨论】:
-
您将如何使用
new做到这一点? -
另一个可能的重复:stackoverflow.com/questions/751804/…
标签: design-patterns