Beispiel #1
0
        static void Main(string[] args)
        {
            CarFactory   factory   = null;
            CarAssembler assembler = new CarAssembler();

            string carType;

            Console.WriteLine("Enter a car type: ");

            carType = Console.ReadLine();

            if (carType == "toyota" || carType == "Toyota")
            {
                factory = new ToyotaFactory("Corolla", 120);
            }
            else
            {
                factory = new SuzukiFactory("Civic", 160);
            }

            assembler.AssembleCar(factory);
            Console.ReadKey();
        }
Beispiel #2
0
        public void AssembleCar(CarFactory factory)
        {
            Car car = factory.GetCar();

            Console.WriteLine("Company: {0} \n Model: {1} \n Speed: {2}", car.Company, car.Model, car.Speed);
        }