Пример #1
0
        static void Main()
        {
            //List<Animal> animals = new List<Animal>
            Animal[] animals = new Animal[]
            {
                new Cat("Alex", 2, Sex.female),
                new Dog("Bruno",3, Sex.male),
                new Frog("Bro",4, Sex.male),
                new Tomcat("Tom", 2),
                new Kitten("Kitty", 5)
            };

            Console.WriteLine(animals.Average(a => a.Age));
        }
Пример #2
0
 public override void ProduceSound(Animal newCat)
 {
     Console.WriteLine("Bau");
 }
Пример #3
0
 public abstract void ProduceSound(Animal typeAnimal);