Пример #1
0
        static void Main(string[] args)
        {
            Console.Write("Enter car name: ");
            var input = Console.ReadLine();

            AutoFactory factory = new AutoFactory();
            IAuto       car     = factory.CreateInstance(input);

            car.TurnOn();
            car.TurnOff();
        }
Пример #2
0
        static void Main(string[] args)
        {
            string name = string.Empty;

            if (args.Length > 0)
            {
                name = args[0];
            }
            AutoFactory factory = new AutoFactory();
            IAuto       car     = factory.GetAuto(name);

            //IAuto car = GetCar(name);
            car.TurnOn();
            car.TurnOff();
            Console.ReadKey();
        }