コード例 #1
0
ファイル: Program.cs プロジェクト: zq791076654/DesignPatterns
        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);
        }