using System; namespace OOP_CONSTRUCTORS { class Animals { private string name; private string sound; public const string shelter = "Aibo's Hangout"; public Animals() : this("No Name", "No Sound") { } public Animals(string name) : this(name, "No Sound") { } public Animals(string n, string s) { setName(n); SoundCap = s; Console.WriteLine(SoundCap); Counter = 1; Console.WriteLine(Count); } public void introduced() { Console.WriteLine("Voice of {0} sounds like {1}", name, sound); } public void setName(string n) { int i = 1; foreach(char c in n) { if (!char.IsLetter(c)) { i = 0; }
Comments
Post a Comment