摘要:        
1.定义:定义一个用于创建对象的接口,让子类决定实例化哪一个类。Factory Method使得一个类的实例化延迟到子类。2.实现代码如下: /// /// 工厂方法 /// public abstract class Factory { public abstract Compute GetCompute(); } public class AddFactory : Factory { public override Compute GetCompute() { return new...    阅读全文
posted @ 2013-09-22 22:17
学亮
阅读(300)
评论(0)
推荐(1)
        
            
        
        
摘要:        
简单工厂1.只有一个工厂(具体的,没有抽象)2.只生产一种产品(抽象的产品)3.这种产品可以有多种具体产品类型(派生)代码实现class Program { static void Main(string[] args) { int number1 = 1; int number2 = 2; Compute compute = SimpleFactory.GetComputer("+"); compute.Number1 = number1; comp...    阅读全文
posted @ 2013-09-22 00:23
学亮
阅读(210)
评论(0)
推荐(0)
        
                    
                
浙公网安备 33010602011771号