예제 #1
0
        static void Main(string[] args)
        {
            var car = CarConstructor.Construct(new Transmission(), new Color(), new Engine());

            car.WriteCar();;

            CarConstructor.Reconstruct(car, new Engine("ModelX", 5, 1000));
            car.WriteCar();

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            var car = CarConstructor.Construct(Transmission.AutomaticTransmission, Color.Black, Engine.BMW500);

            car.WriteCar();;

            CarConstructor.Reconstruct(ref car, Engine.Spotr1);
            car.WriteCar();

            Console.ReadLine();
        }
예제 #3
0
        static void Main(string[] args)
        {
            var red    = new Color("red");
            var merlin = new Engine(3000, 744);
            var defaultTransmission = new Transmission();
            var car = new CarConstructor();

            car.Construct(red, merlin, defaultTransmission);
            car.GetInfo();
            var engine2 = new Engine(654, 120);

            car.Reconstruct(engine2);
            car.GetInfo();
        }