Example #1
0
        static void Main(string[] args)
        {
            Animal[] animales =
            {
                new Carnivoro("Leon"),
                new Herviboro("Jirafa")
            };

            Console.WriteLine("Lista de animales");

            foreach (Animal animal in animales)
            {
                Console.WriteLine(animal);
            }

            Lobo lobo = new Lobo("Lobezno");

            lobo.Cazar();

            (lobo as Carnivoro).Cazar();

            Pinguino pingu = new Pinguino("Tux");

            pingu.Cazar();
            //(pingu as Carnivoro).Cazar();

            Console.ReadLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            Animal[] animales =
            {
                new Carnivoro("Leon"),
                new Herbivoro("jirafa")
            };
            Console.WriteLine("lista de animales");
            foreach (var anima in animales)
            {
                Console.WriteLine(anima);
            }

            Lobo lobo = new Lobo("Lobezno");

            lobo.Cazar();

            (lobo as Carnivoro).Cazar();

            Pinguino pingu = new Pinguino("Tux");

            pingu.Cazar();
            (pingu as Carnivoro).Cazar();
        }