예제 #1
0
        static void Main(string[] args)
        {
            CarFactory ford_car = new FordFactory();
            Client     c1       = new Client(ford_car);

            Console.WriteLine("Kuzov: {0}    Max speed {1} is {2} km/hour", c1.KuzovAuto(), c1.ToString(), c1.RunMaxSpeed());

            CarFactory audi_car = new AudiFactory();
            Client     c2       = new Client(audi_car);

            Console.WriteLine("Kuzov: {0}    Max speed {1} is {2} km/hour ", c2.KuzovAuto(), c2.ToString(), c2.RunMaxSpeed());
        }
예제 #2
0
        static void Main(string[] args)
        {
            CarFactory ford_car = new FordFactory();
            Client     c1       = new Client(ford_car);

            Console.WriteLine("Shape: {0}    Max speed {1} is {2} km/h", c1.ShapeAuto(), c1.ToString(), c1.RunMaxSpeed());

            CarFactory audi_car = AudiFactory.getAudiFactory();
            Client     c2       = new Client(audi_car);

            Console.WriteLine("Shape: {0}    Max speed {1} is {2} km/h ", c2.ShapeAuto(), c2.ToString(), c2.RunMaxSpeed());
        }
예제 #3
0
        static void Main(string[] args)
        {
            CarFactory ford_car = new FordFactory();
            Client     c1       = new Client(ford_car);

            Console.WriteLine("Максимальная скорость {0} в типе кузова {2} составляет {1} км/час", c1.ToString(), c1.RunMaxSpeed(), c1.TypeBodywork());

            CarFactory audi_car = AudiFactory.MyAudi;
            Client     c2       = new Client(audi_car);

            Console.WriteLine("Максимальная скорость {0} в типе кузова {2} составляет {1} км/час", c2.ToString(), c2.RunMaxSpeed(), c2.TypeBodywork());
            Console.ReadKey();
        }
예제 #4
0
        static void Main(string[] args)
        {
            CarFactory ford_car = new FordFactory();
            CarFactory audi_car = new AudiFactory();
            Client     c1       = new Client(ford_car);

            Client c2 = new Client(audi_car);

            Console.WriteLine("Максимальная скорость {0} составляет {1} км/час, а также кузов типа {2}",
                              c1.ToString(), c1.RunMaxSpeed(), c1.GetBodyType());

            Console.WriteLine("Максимальная скорость {0} составляет {1} км/час, а также кузов типа {2}",
                              c2.ToString(), c2.RunMaxSpeed(), c2.GetBodyType());
        }
예제 #5
0
파일: Program.cs 프로젝트: ksush23/Patterns
        static void Main(string[] args)
        {
            ICarFactory   carFactory = new ToyotaFactory();
            ClientFactory client1    = new ClientFactory(carFactory);

            client1.Run();

            carFactory = new FordFactory();
            ClientFactory client2 = new ClientFactory(carFactory);

            client2.Run();

            Console.ReadKey();
        }
예제 #6
0
        public static void EX2()
        {
            AbstractFabricaDeCarro fabrica = new FiatFactory();

            AbstractCarroPopular carroPopular = fabrica.CriarCarroPopular();

            carroPopular.Detalhes();

            fabrica = new FordFactory();

            carroPopular = fabrica.CriarCarroPopular();
            carroPopular.Detalhes();

            fabrica.CriarCarroSedan().Detalhes();
        }
예제 #7
0
        public static void Main(string[] args)
        {
            Factory nissanFactory = new NissanFactory();

            CarDealership carDealership = new CarDealership(nissanFactory);

            carDealership.OrderVehicles();

            Factory fordFactory = new FordFactory();

            carDealership = new CarDealership(fordFactory);
            carDealership.OrderVehicles();

            Console.ReadKey();
        }
예제 #8
0
        static void Main(string[] args)
        {
            ICarFactory carFactory = new ToyotaFactory();
            Car         myCar      = carFactory.CreateCar();

            myCar.Info();
            Engine myEngine = carFactory.CreateEngine();

            myEngine.GetPower();
            carFactory = new FordFactory();
            myCar      = carFactory.CreateCar();
            myCar.Info();
            myEngine = carFactory.CreateEngine();
            myEngine.GetPower();
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            CarFactory ford_car = new FordFactory();
            Client     c1       = new Client(ford_car);

            Console.WriteLine("Максимальная скорость {0} составляет {1} км/час с кузовом типа \"{2}\"", c1.ToString(), c1.RunMaxSpeed(), c1.GetBodyStyle());

            CarFactory audiCar       = new AudiFactory();
            Client     clientForAudi = new Client(audiCar);

            Console.WriteLine("Максимальная скорость {0} составляет {1} км/час с кузовом типа \"{2}\"", clientForAudi.Name, clientForAudi.RunMaxSpeed(), clientForAudi.GetBodyStyle());

            var    Lada          = LadaFactory.Factory;
            Client clientForLada = new Client(Lada);

            Console.WriteLine("Максимальная скорость {0} составляет {1} км/час с кузовом типа \"{2}\"", clientForLada.Name, clientForLada.RunMaxSpeed(), clientForLada.GetBodyStyle());
        }
예제 #10
0
        static void Main(string[] args)
        {
            ICarFactory   carFactory = new ToyotaFactory();
            ClientFactory client1    = new ClientFactory(carFactory);

            client1.Run();

            carFactory = new FordFactory();
            ClientFactory client2 = new ClientFactory(carFactory);

            client2.Run();
            Console.WriteLine("");

            carFactory = new MercedesFactory();
            ClientFactory client3 = new ClientFactory(carFactory);

            client3.Run();
            Console.WriteLine("");

            Console.ReadKey();
        }