Пример #1
0
        static void Main(string[] args)
        {
            IVehicleBuilder builder        = new HeroBuilder();
            var             vehicleCreator = new VehicleCreator(builder);
            var             vehicle        = vehicleCreator.CreateVehicle().GetVehicle(); //Here same method calls below also but both has different result

            Console.WriteLine(string.Format("ModelName:{0}\nSpeed:{1}\nBrand:{2}\n", vehicle.ModelName, vehicle.Speed, vehicle.BrandName));
            Console.WriteLine("----------------------------------------------------------");
            builder        = new HondaBuilder();
            vehicleCreator = new VehicleCreator(builder);
            vehicle        = vehicleCreator.CreateVehicle().GetVehicle();
            Console.WriteLine(string.Format("ModelName:{0}\nSpeed:{1}\nBrand:{2}\n", vehicle.ModelName, vehicle.Speed, vehicle.BrandName));
            Console.ReadKey();
        }
Пример #2
0
        public void Main()
        {
            var vehicleCreator = new VehicleCreator(new HeroBuilder());

            vehicleCreator.CreateVehicle();
            Vehicle vehicle = vehicleCreator.GetVehicle();

            vehicle.ShowInfo();

            Console.WriteLine("---------------------------------------------");

            vehicleCreator = new VehicleCreator(new HondaBuilder());
            vehicleCreator.CreateVehicle();
            vehicle = vehicleCreator.GetVehicle();
            vehicle.ShowInfo();
        }
Пример #3
0
        private static void Main()
        {
            var vehicleCreator = new VehicleCreator(new FordExplorerBuilder());

            vehicleCreator.CreateVehicle();
            var vehicle = vehicleCreator.GetVehicle();

            vehicle.ShowInfo();

            Console.WriteLine("---------------------------------------------");

            vehicleCreator = new VehicleCreator(new LincolnAviatorBuilder());
            vehicleCreator.CreateVehicle();
            vehicle = vehicleCreator.GetVehicle();
            vehicle.ShowInfo();
        }
Пример #4
0
        static void Main(string[] args)
        {
            var vehicleCreator = new VehicleCreator(new HeroBuilder());

            vehicleCreator.CreateVehicle();
            var vehicle = vehicleCreator.GetVehicle();

            vehicle.ShowInfo();

            Console.WriteLine("---------------------------------------------");

            vehicleCreator = new VehicleCreator(new HondaBuilder());
            vehicleCreator.CreateVehicle();
            vehicle = vehicleCreator.GetVehicle();
            vehicle.ShowInfo();

            Console.ReadKey();
        }