Example #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.
 }
        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();
        }