- enum Blood { A,B,AB,O}
- class Father
- {
- public Father(string firstName,int wealth,Blood blood)
- {
- this.firstName = firstName;
- this.wealth = wealth;
- this.blood = blood;
- }
- private string firstName;
- private int wealth;
- private Blood blood;
- public void Introduce()
- {
- Console.WriteLine("姓名{0},资产{1},血型{2}",firstName,wealth,blo);
- }
- }
复制代码
- class Son:Father
- {
- public Son(string firstName,int wealth,Blood blood):base(firstName,wealth,blood)
- {
- }
- public void PlayGame()
- {
- base.Introduce();
- Console.WriteLine("玩游戏");
- }
- }
复制代码
- class Daughter:Father
- {
- public Daughter(string firstName,int wealth,Blood blood):base(firstName,wealth,blood)
- {
- }
- public void Dance()
- {
- base.Introduce();
- Console.WriteLine("跳舞");
- }
- }
复制代码
不知道你说的是不是这样写? |