예제 #1
0
        static void Main(string[] args)
        {
            IMobilePhone nokiaMobilePhone = new Nokia();
            MobileClient nokiaClient      = new MobileClient(nokiaMobilePhone);

            Console.WriteLine("********* NOKIA **********");
            Console.WriteLine(nokiaClient.GetSmartPhoneModelDetails());
            Console.WriteLine(nokiaClient.GetNormalPhoneModelDetails());

            IMobilePhone samsungMobilePhone = new Samsung();
            MobileClient samsungClient      = new MobileClient(samsungMobilePhone);

            Console.WriteLine("******* SAMSUNG **********");
            Console.WriteLine(samsungClient.GetSmartPhoneModelDetails());
            Console.WriteLine(samsungClient.GetNormalPhoneModelDetails());

            IMobilePhone motoMobilePhone = new Moto();
            MobileClient motoClient      = new MobileClient(motoMobilePhone);

            Console.WriteLine("******* MOTO **********");
            //Console.WriteLine(motoClient.GetNormalPhoneModelDetails());
            Console.WriteLine(motoClient.GetSmartPhoneModelDetails());

            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            ITelephoneFactory nokia   = new Nokia("Nokia");
            ITelephoneFactory samsung = new Samsung("Samsung");

            Console.WriteLine($"В фабрике {nokia.FactoryName()} -  {nokia.CreateAccumulator().AccumulatorModel()}, {nokia.CreateDisplay().DisplayModel()}");
            Console.WriteLine($"Тип аккумулятора {nokia.CreateDisplay().AccumulatorType()}");
            Console.WriteLine("******************************");
            Console.WriteLine($"В фабрике {samsung.FactoryName()} -  {samsung.CreateAccumulator().AccumulatorModel()}, {samsung.CreateDisplay().DisplayModel()}");
            Console.WriteLine($"Тип аккумулятора {samsung.CreateDisplay().AccumulatorType()}");
        }