摘要:
在《简单工厂模式和策略模式的区别》中说道简单工厂中用一个Factory类来专门负责产生具体的类,在添加一个功能的时候要做两个动作,一是添加一个FunctionC类继承自Function类,二是要修改Factory类的CreateObject方法。 代码如下:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->publicclassFactory{publicstaticFunctionCreateObject(stringcondition)
阅读全文