Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            IVehicleFactory 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());

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

            Console.WriteLine("\n");
            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();
        }
 public Hero(HeroFactory factory)
 {
     weapon   = factory.CreateWeapon();
     movement = factory.CreateMovement();
 }