Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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
            ;
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        private void Quack_Button_Click(object sender, RoutedEventArgs e)
        {
            Duck duck1 = new InheritanceIntro.Duck(9, "Kyle");

            duck1.Quack();
        }
Exemplo n.º 5
0
        private void Quack(object sender, RoutedEventArgs e)
        {
            Duck duck = new InheritanceIntro.Duck(12, "Fredrich");

            duck.Quack();
        }