예제 #1
0
        static void Main(string[] args)
        {
            JuewWeiFactory shFactory = new ShangHaiFactory();

            shFactory.CreateYaBo();
            shFactory.CreateYaJia();

            JuewWeiFactory scFactory = new SiChuanFactory();

            scFactory.CreateYaBo();
            scFactory.CreateYaJia();

            DeviceFactory americanFactory = new AmericanFactory();

            americanFactory.CreateComputer();
            americanFactory.CreatePhone();

            DeviceFactory chinaFactory = new ChinaFactory();

            chinaFactory.CreateComputer();
            chinaFactory.CreatePhone();

            Console.ReadKey();
        }
예제 #2
0
        public static void UseAmericaItems()
        {
            AbstractFactory factory = new AmericanFactory();

            PrintNames(factory);
        }