Created
October 12, 2012 12:50
-
-
Save DuffleOne/3879065 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Windows.Forms; | |
public class Chorus { | |
Dog fluffles; | |
Dog jake; | |
Dog harry; | |
Dog kim; | |
List<Dog> dogs; | |
public Chorus() { | |
fluffles = new Dog("Fluffles", "Great Dane", 80, "black"); | |
jake = new Dog("Jake", "American Foxhound", 64, "brown and white"); | |
harry = new Dog("Harry", "American Bulldog", 50, "brown"); | |
kim = new Dog("Kim", "Chihuahua", 12, "brown"); | |
kim.Bark = "Gruff!"; | |
try { | |
dogs.Add(fluffles); | |
dogs.Add(jake); | |
dogs.Add(harry); | |
dogs.Add(kim); | |
} catch (Exception ex) { | |
MessageBox.Show("Sorry, could not create a list of dogs in the class \"Chorus\"..."); | |
} | |
} | |
public string getSpeeches() { | |
string output = "All dogs have " + Dog.legs + " legs.\n\n"; | |
foreach (Dog current in dogs) { | |
output += current.getSpeech() + "\n"; | |
} | |
return output; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment