static void Main(string[] args) { Console.WriteLine(args.ToString()); Horse horse = new Horse("Arthur", true); Horse horse2 = new Horse("Igal", false); Dog dog = new Dog("Bobik", "Bones"); Wolf wolf = new Wolf("Beast", "Rabbits", "Northern Pack"); Poodle poodle = new Poodle("Toy", "Sausages", "Two"); PetWolf petWolf = new PetWolf("Baby wolf", "Milk", "Eastern pack"); Animal[] abc = new Animal[] { horse, dog, wolf, poodle, petWolf }; AnimalSing(abc); Console.WriteLine(); Horse[] horses = new Horse[] { horse, horse2 }; Horse[] racingHorses = GetRacingHorses(horses); for (int i = 0; i < racingHorses.Length; i++) { Console.WriteLine(racingHorses[i]._name); } Console.WriteLine(); Console.WriteLine(horse.ToString()); Console.WriteLine(dog.ToString()); Console.WriteLine(wolf.ToString()); Console.WriteLine(poodle.ToString()); Console.WriteLine(petWolf.ToString()); Console.ReadKey(); }
public static void AnimalSing(Animal[] a) { a[1] = new Dog("Shon", "Bonzo"); a[2] = new Poodle("pilpel", "Cats", "12"); a[3] = new Wolf("Alpha", "fish", "Loneliness"); a[4] = new Horse("Chita", true); a[5] = new PetWolf("Wolfy", "Birds", "Loneliness"); for (int i = 0; i < a.Length; i++) { a[i].MakeSound(); Console.WriteLine(a[i]); } }