C#认证考试试题汇编 Test

test1_1

-------------------------------------------------------------------------------------------------------------------------------------------------

test1_11

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

test2_11

namespace Test2_11
{
public class Animal
{
private bool m_sex;
private string m_sound;

public bool Sex
{
get { return m_sex; }
set { m_sex = value; }
}
public string Sound
{
get { return m_sound; }
set { m_sound = value; }
}
public Animal()
{
Sex = false;
Sound = "Howl...";
}

public string Roar(string dog,string ct,string cow)
{
return String.Format("{0},{1},{2}",Sound);
}
}

class Dog : Animal
{
public string Roar()
{
return ("Dog:")+string.Format("{0}",Sound);
}
}
class Cat : Animal
{
public string Roar()
{
return ("Cat:") + string.Format("{0}", Sound);
}
}
class Cow : Animal
{
public string Roar()
{
return ("Cow:") + string.Format("{0}", Sound);
}
}
}

原文地址:https://www.cnblogs.com/uiop123/p/7507778.html