Exemplo n.º 1
0
        static void Main(string[] args)
        {
            string carName = args[0];

            //Caller knows about the concrete factory type here
            //Meaning the caller knows which factory type to be called
            Autofactory factory = new Autofactory();

            IAuto car = factory.CreateInstance(carName);

            car.TurnOn();
            car.TurnOff();

            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string carName = args[0];

            //Caller knows about the concrete factory type here
            //Meaning the caller knows which factory type to be called
            Autofactory factory = new Autofactory();

            IAuto car = factory.CreateInstance(carName);

            car.TurnOn();
            car.TurnOff();

            Console.ReadKey();
        }