예제 #1
0
        static void Main()
        {
            // Honda Factory
            IVehicleFactory hondaFactory = new HondaFactory();
            VehicleClient   hondaClient  = new VehicleClient(hondaFactory, "Regular");

            Console.WriteLine("******* Honda **********");
            Console.WriteLine($"Current Factory- {hondaClient.GetFactoryType}");
            Console.WriteLine($"{hondaClient.GetBikeName}");
            Console.WriteLine($"{hondaClient.GetScooterName}");

            hondaClient = new VehicleClient(hondaFactory, "Sports");
            Console.WriteLine($"Current Factory- {hondaClient.GetFactoryType}");
            Console.WriteLine($"{hondaClient.GetBikeName}");
            Console.WriteLine($"{hondaClient.GetScooterName}");


            // Hero Factory
            IVehicleFactory heroFactory = new HeroFactory();
            VehicleClient   heroClient  = new VehicleClient(heroFactory, "Regular");

            Console.WriteLine("******* Hero **********");
            Console.WriteLine($"Current Factory- {heroClient.GetFactoryType}");
            Console.WriteLine($"{heroClient.GetBikeName}");
            Console.WriteLine($"{heroClient.GetScooterName}");

            heroClient = new VehicleClient(heroFactory, "Sports");
            Console.WriteLine($"Current Factory- {heroClient.GetFactoryType}");
            Console.WriteLine($"{heroClient.GetBikeName}");
            Console.WriteLine($"{heroClient.GetScooterName}");
        }
예제 #2
0
        static void Main(string[] args)
        {
            VehicleFactory honda       = new HondaFactory();
            VehicleClient  hondaclient = new VehicleClient(honda, "Regular");

            Console.WriteLine("******* Honda **********");
            Console.WriteLine(hondaclient.GetBikeName());
            Console.WriteLine(hondaclient.GetScooterName());

            hondaclient = new VehicleClient(honda, "Sports");
            Console.WriteLine(hondaclient.GetBikeName());
            Console.WriteLine(hondaclient.GetScooterName());

            VehicleFactory hero       = new HeroFactory();
            VehicleClient  heroclient = new VehicleClient(hero, "Regular");

            Console.WriteLine("******* Hero **********");
            Console.WriteLine(heroclient.GetBikeName());
            Console.WriteLine(heroclient.GetScooterName());

            heroclient = new VehicleClient(hero, "Sports");
            Console.WriteLine(heroclient.GetBikeName());
            Console.WriteLine(heroclient.GetScooterName());

            Console.ReadKey();
        }