static void Main(string[] args) { ShangHaiFactory shangHaiFactory = new ShangHaiFactory(); ShangHaiYaBo shangHaiYaBo = (ShangHaiYaBo)shangHaiFactory.CreateYaBo(); shangHaiYaBo.Print(); Console.ReadKey(); }
static void Main(string[] args) { // 南昌工厂制作南昌的鸭脖和鸭架 AbstractFactory nanChangFactory = new NanChangFactory(); YaBo nanChangYabo = nanChangFactory.CreateYaBo(); nanChangYabo.Print(); YaJia nanChangYajia = nanChangFactory.CreateYaJia(); nanChangYajia.Print(); // 上海工厂制作上海的鸭脖和鸭架 AbstractFactory shangHaiFactory = new ShangHaiFactory(); shangHaiFactory.CreateYaBo().Print(); shangHaiFactory.CreateYaJia().Print(); Console.Read(); }