--上机1
public class person
{
public string name{get;set;}
public int age { get; set; }
public person(){}
public person(string name,int age) {
this.name = name;
this.age = age;
}
}
public class student:person
{
public int no { get; set; }
public student() { }
public student(string name, int age, int no){
base.name = name;
base.age = age;
this.no = no;
}
}
public class truck:vehicle
{
public truck(string type,string pro):base(type,pro) {
base.type = type;
base.produce = pro;
}
public void truckrun() {
Console.WriteLine("型号为{0},产地为{1}的卡车在行驶",base.type,base.produce);
}
}
public class vehicle
{
public string type;
public string produce;
public vehicle(string type,string pro) {
this.type = type;
this.produce = pro;
}
public void vehiclerun() {
Console.WriteLine("汽车在行驶");
}
}
class Program
{
static void Main(string[] args)
{
truck t = new truck("奔驰