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 InheritanceIntro.Duck(9, "Kyle"); duck1.SayName(); Frog frog1 = new InheritanceIntro.Frog(3, "Timmy"); frog1.SayName(); Lion lion1 = new InheritanceIntro.Lion(26, "bob"); lion1.SayName(); }
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 duck = new InheritanceIntro.Duck(102, "Hi"); duck.SayName() // Make A Duck // Have it say its name ; }
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("Labradoodle", 35, "Pax"); Dog dog2 = new Dog("Mini Labradoodle", 15, "Sophie"); // 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 duck = new InheritanceIntro.Duck("im high", 102); duck.SayName(); }
private void Quack_Button_Click(object sender, RoutedEventArgs e) { Duck duck1 = new InheritanceIntro.Duck(9, "Kyle"); duck1.Quack(); }
private void Quack(object sender, RoutedEventArgs e) { Duck duck = new InheritanceIntro.Duck(12, "Fredrich"); duck.Quack(); }