Exemplo n.º 1
0
        static void Main(string[] args)
        {
            List<Animal> petList = new List<Animal>();
            Cat meowser = new Cat("Meowser", "Cat", true, true);
            Dog pepper = new Dog("Pepper", "Dog", true, true);
            Turtle rocky = new Turtle("Rocky", "Turtle", false, false);

            petList.Add(meowser);
            petList.Add(pepper);
            petList.Add(rocky);

            foreach (Animal pet in petList)
            {
                Console.WriteLine(pet.Name + ": " + pet.Species);
            }
            Console.ReadLine();
        }