Example #1
0
        static void Main(string[] args)
        {
            ShangHaiFactory shangHaiFactory = new ShangHaiFactory();
            ShangHaiYaBo    shangHaiYaBo    = (ShangHaiYaBo)shangHaiFactory.CreateYaBo();

            shangHaiYaBo.Print();

            Console.ReadKey();
        }
Example #2
0
        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();

        }
Example #3
0
        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();
        }