Esempio 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 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();
        }
Esempio 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("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();
            }

            //make a duck
            //have it say its name
            Duck duck = new Duck("Bob", 100);

            duck.SayName();
        }
Esempio n. 4
0
        private void SayName_Button_Click(object sender, RoutedEventArgs e)
        {
            List <Animal> animal = new List <Animal>();

            animals.Add(frog);
            animal.Add(Dog);
            animals.Add
            // 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 Duck(28, "Daffy");

            duck.SayName();
        }