Пример #1
0
        static void Main(string[] args)
        {
            SedanBuilder        sedan        = new SedanBuilder();
            CoupeBuilder        coupe        = new CoupeBuilder();
            StationWagonBuilder stationWagon = new StationWagonBuilder();
            HatchbackBuilder    hatchback    = new HatchbackBuilder();

            CarCreator carCreator = new CarCreator();

            carCreator.Create(sedan);
            Car car1 = sedan.Car;

            car1.Name = "Daewoo Lanos";
            car1.Info();

            carCreator.Create(coupe);
            Car car2 = coupe.Car;

            car2.Name = "Ford Probe ";
            car2.Info();

            carCreator.Create(stationWagon);
            Car car3 = stationWagon.Car;

            car3.Name = "UAZ Patriot ";
            car3.Info();

            carCreator.Create(hatchback);
            Car car4 = hatchback.Car;

            car4.Name = "Hyundai Getz ";
            car4.Info();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var carACreator = new CarCreator(new CarABuilder());

            carACreator.CreateCar();
            var carA = carACreator.GetCar();

            carA.ShowInfo();

            var carBCreator = new CarCreator(new CarBBuilder());

            carBCreator.CreateCar();
            var carB = carBCreator.GetCar();

            carB.ShowInfo();
        }