Пример #1
0
        static void Main(string[] args)
        {
            var pesho = new Client("Pesho", new Hertz());
            var gosho = new Client("Gosho", new MegaLease());

            pesho.LeaseCar();
            pesho.Goto("Varna");

            gosho.LeaseCar();
            gosho.Goto("Pernik");

            var misho = new Client("Misho", new MegaLease());
            misho.Goto("Burgas");
            misho.LeaseBus();
        }
        static void Main(string[] args)
        {
            // Abstract factory #1
            AbstractFactory factory1 = new Factory1();
            Client client1 = new Client(factory1);
            client1.Run();

            // Abstract factory #2
            AbstractFactory factory2 = new Factory2();
            Client client2 = new Client(factory2);
            client2.Run();
        }