public ClientCarBuilder()
        {
            System.Console.WriteLine("****CARBUILDER****");
            var cars = new List <Car>
            {
                new Car {
                    Carcas = "blue", Engine = "8v", Wheels = "duplon"
                },
                new Car {
                    Carcas = "red", Engine = "2cv", Wheels = "michelin"
                },
                new Car {
                    Carcas = "yellow", Engine = "10v", Wheels = "duplon"
                },
                new Car {
                    Carcas = "green", Engine = "2000cc", Wheels = "michelin"
                }
            };

            var builder2     = new BuildCar(cars);
            var director2    = new CarDirector(builder2);
            var buildThatCar = builder2.GetCar();

            System.Console.WriteLine(buildThatCar);
        }
示例#2
0
        static void Main(string[] args)
        {
            CarBuilder  carBuilder  = new Bmw(); //Upcasting
            CarDirector carDirector = new CarDirector(carBuilder);

            Console.WriteLine(carBuilder.GetCar.ToString());

            carBuilder  = new Mercedes(); //Upcasting
            carDirector = new CarDirector(carBuilder);
            Console.WriteLine(carBuilder.GetCar.ToString());

            Console.Read();
        }