Ejemplo n.º 1
0
 public static void Ride(this WildHorse horse)
 {
     horse.Catch();
     horse.Mount();
     // No need to start, the wild horse is already
     // running for it's life when someoune mounts.
 }
Ejemplo n.º 2
0
        public void TestRide()
        {
Debug.WriteLine("Riding horse...");
Horse horse = new Horse();
horse.Ride();

Debug.WriteLine("Riding wild horse...");
WildHorse wildHorse = new WildHorse();
wildHorse.Ride();

Debug.WriteLine("Treating wild horse as horse...");
horse = wildHorse;
horse.Ride();
        }