标签:des style blog io color sp div on log
void Main() { SimpleFactory.GetProduct("A").Dump(); SimpleFactory.GetProduct("B").Dump(); } class Product{} class ProductA:Product{} class ProductB:Product{} class SimpleFactory{ public static Product GetProduct(string name){ switch (name) { case "A":return new ProductA(); case "B":return new ProductB(); default:return null; } } }
DesignPattern_Creational_SimpleFactory
标签:des style blog io color sp div on log
原文地址:http://www.cnblogs.com/rammderek/p/4102833.html