Esempio n. 1
0
        public static void Main1(string[] args)
        {
            AbstractFactory appleFactory  = FactoryProducer.GetFactory("Apple");
            AbstractFactory huaweiFactory = FactoryProducer.GetFactory("Huawei");
            //AbstractFactory xiaomiFactory = FactoryProducer.GetFactory("Xiaomi");

            Phone applePhone = appleFactory.GetPhone();

            applePhone.Call();
            Computer appleComputer = appleFactory.GetComputer();

            appleComputer.Work();
            Pad applePad = appleFactory.GetPad();

            applePad.Play();


            Phone huaweiPhone = huaweiFactory.GetPhone();

            huaweiPhone.Call();
            Computer huaweiComputer = huaweiFactory.GetComputer();

            huaweiComputer.Work();
            Pad huaweiPad = huaweiFactory.GetPad();

            huaweiPad.Play();

            //Console.WriteLine();

            //Phone xiaomiPhone = xiaomiFactory.GetPhone();
            //xiaomiPhone.Call();
            //Computer xiaomiComputer = xiaomiFactory.GetComputer();
            //xiaomiComputer.Work();
            //Pad xiaomiPad = xiaomiFactory.GetPad();
            //xiaomiPad.Play();
        }