Exemplo n.º 1
0
        public static void CovariantOverridesInAction()
        {
            Animal animal = new Lion();

            Console.WriteLine("Hello World! Animal food tastes " + animal.GetFood().Taste());
            // Should print "Hello world! Animal food tastes meaty"
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Animal lion = new Lion();

            PrintAnimal(lion);

            Console.WriteLine();

            Animal seal = new Seal();

            PrintAnimal(seal);

            Console.WriteLine();

            Animal bear = new Bear();

            PrintAnimal(bear);
        }