private void SayName_Button_Click(object sender, RoutedEventArgs e) { // Define a new List of dogs List <Dog> dogs = new List <Dog>(); // Instantiate some dog objects Dog dog1 = new Dog("Muppet", 20, "Rolf"); Dog dog2 = new Dog("Golden Retriever", 30, "Air Bud"); // Add the dogs to the list dogs.Add(dog1); dogs.Add(dog2); // Loop through the list and call a method on the objects foreach (Dog d in dogs) { d.SayName(); } Duck duck1 = new Duck(9, "Kyle"); duck1.SayName(); Frog frog1 = new Frog(20, "Max", "poisionous"); frog1.SayName(); Cow Cow1 = new Cow(9, "Hunt"); Cow1.SayName(); Tree tree1 = new Tree("XYXYYXYXYXY"); }
private void SayName_Button_Click(object sender, RoutedEventArgs e) { // Define a new List of dogs List <Dog> dogs = new List <Dog>(); // Instantiate some dog objects Dog dog1 = new Dog("Muppet", 20, "Rolf"); Dog dog2 = new Dog("Golden Retriever", 30, "Air Bud"); // Add the dogs to the list dogs.Add(dog1); dogs.Add(dog2); // Loop through the list and call a method on the objects foreach (Dog d in dogs) { d.SayName(); } Duck duck1 = new Duck(15, "Kyle"); duck1.SayName(); Frog frog1 = new Frog(10, "Kermit", true); frog1.SayName(); Lion lion1 = new Lion(60, "Nala", false); lion1.SayName(); }