using System;
using System.Collections.Generic;
using System.Text;
namespace Practise
{
class Program
{
class Father
{
protected Father()
{
}
protected Father(string lastName, double property, string bloodType)
{
this.LastName=lastName;
this.Property=property ;
this.BloodType = bloodType;
}
private string lastName;
public string LastName
{
get { return lastName; }
set { lastName = value; }
}
private double property;
public double Property
{
get { return property; }
set { property = value; }
}
private string bloodType;
public string BloodType
{
get { return bloodType; }
set { bloodType = value; }
}
}
class Son : Father
{
public Son(string lastName , double property, string bloodType):base(lastName,property,bloodType)
{
}
public void PlayGame()
{
Console.WriteLine("我的名字叫:{0} 我的血型为:{1} 我的财产为:{2} 我在游戏",this.LastName,this.BloodType,this.Property);
}
}
class Daughter:Father
{
public Daughter(string lastName, double property, string bloodType): base(lastName, property, bloodType)
{
}
public void Dance( )
{
Console.WriteLine("我的名字叫:{0} 我的血型为:{1} 我的财产为:{2} 我在跳舞",this.LastName,this.BloodType,this.Property);
}
}
static void Main(string[] args)
{
Son newSon = new Son("儿子", 2000, "o");
newSon.PlayGame();
Daughter newDat = new Daughter("女儿", 1500, "AB");
newDat.Dance();
Console.ReadLine();
}
}
}
|
|