Пример #1
0
        public static void Test()
        {
            ChinaFactory factory = new HaierFactory();
            AirConditioner ac1 = factory.CreateAircondition();
            Fridge f1 = factory.CreateFridge();
            Console.WriteLine(ac1.Name);
            Console.WriteLine(f1.Name);

            ChinaFactory greeFactory = new GreeFactory();
            AirConditioner ac2 = greeFactory.CreateAircondition();
            Fridge f2 = greeFactory.CreateFridge();
            Console.WriteLine(ac2.Name);
            Console.WriteLine(f2.Name);
        }
Пример #2
0
        public static void Test()
        {
            ChinaFactory   factory = new HaierFactory();
            AirConditioner ac1     = factory.CreateAircondition();
            Fridge         f1      = factory.CreateFridge();

            Console.WriteLine(ac1.Name);
            Console.WriteLine(f1.Name);

            ChinaFactory   greeFactory = new GreeFactory();
            AirConditioner ac2         = greeFactory.CreateAircondition();
            Fridge         f2          = greeFactory.CreateFridge();

            Console.WriteLine(ac2.Name);
            Console.WriteLine(f2.Name);
        }