static void Main(string[] args) { Eagle eagle = new Eagle("Val", AnimalCategories.bird); Console.WriteLine(eagle); eagle.Swim(); eagle.Fly(); eagle.Move(); eagle.Walk(); Console.WriteLine("--------------------------------------------"); Platypus platypus = new Platypus("Orni", AnimalCategories.mammal); Console.WriteLine(platypus); platypus.Move(); platypus.Swim(); platypus.Walk(); Console.WriteLine("---------------------------------------------"); WildDuck wildDuck = new WildDuck("Donald", AnimalCategories.bird); Console.WriteLine(wildDuck); wildDuck.Fly(); wildDuck.Move(); wildDuck.Swim(); wildDuck.Walk(); Console.WriteLine("----------------------------------------------"); Crocodile aligator = new Crocodile("Aligator", AnimalCategories.reptile); Console.WriteLine(aligator); aligator.Crawl(); aligator.Move(); aligator.Swim(); aligator.Walk(); }
static void Main(string[] args) { Dog dog = new Dog(); Cat cat = new Cat(); Crocodile crocodile = new Crocodile(); Shark shark = new Shark(); Owl owl = new Owl(); List<Animal> animals = new List<Animal>(); animals.Add(dog); animals.Add(cat); animals.Add(crocodile); animals.Add(shark); animals.Add(owl); foreach (var animal in animals) { Console.WriteLine(animal.Eat()); } Console.WriteLine(dog.Greet()); }
static void Main(string[] args) { Mammals m = new Mammals(); Console.WriteLine(m.Move()); Console.WriteLine(m.Greet()); m = new Cat(); Console.WriteLine(m.Move()); Console.WriteLine(m.Greet()); m = new Dog(); Console.WriteLine(m.Move()); Console.WriteLine(m.Greet()); Console.WriteLine(); Reptiles r = new Reptiles(); Console.WriteLine(r.Move()); Console.WriteLine(r.Temperature()); r = new Crocodile(); Console.WriteLine(r.Move()); Console.WriteLine(r.Temperature()); Console.WriteLine(); Birds b = new Birds(); Console.WriteLine(b.Move()); Console.WriteLine(b.MakeNest()); b = new Owl(); Console.WriteLine(b.Move()); Console.WriteLine(b.MakeNest()); Console.WriteLine(); Fish f = new Fish(); Console.WriteLine(f.Move()); f = new Shark(); Console.WriteLine(f.Move()); Console.ReadKey(); }