Пример #1
0
        static void Main(string[] args)
        {
            var carConstructor = new CarConstructor();
            var car            = carConstructor.Construct(new Engine("Engine"), new Color("Red"), new Transmission("Transmission"));

            Console.WriteLine(car.Engine.Model);
            carConstructor.Reconstruct(car);
            Console.WriteLine(car.Engine.Model);
        }
Пример #2
0
        static void Main(string[] args)
        {
            var engine       = new Engine(EngineEnum.Dohci4);
            var color        = new Color(ColorEnum.Gainsboro);
            var transmission = new Transmission(TransmissionEnum.ContinuouslyVariableTransmission);

            var car = CarConstructor.Construct(engine, color, transmission);

            Console.WriteLine(car);

            CarConstructor.Reconstruct(car, new Engine(EngineEnum.Dohci4Turbodiesel));
            Console.WriteLine(car);
        }