标签:des style blog io color os sp for div
using System.Reflection; namespace DesignPattern.Creational.FactoryMethod { public class Product { } public class ProductA : Product { } public class ProductB : Product { } public abstract class Factory { public static Factory ChooseFactory(string name) { return Assembly.Load("DesignPattern.Creational") .CreateInstance(string.Format("DesignPattern.Creational.FactoryMethod.{0}", name)) as Factory; } public abstract Product GetProduct(); } public class FactoryA:Factory{ public override Product GetProduct() { return new ProductA(); } } public class FactoryB : Factory { public override Product GetProduct() { return new ProductB(); } } }
DesignPattern_Creational_FactoryMethod
标签:des style blog io color os sp for div
原文地址:http://www.cnblogs.com/rammderek/p/4097732.html