class Program
{
static void Main(string[] args)
{
student s = new student();
s.age = 12;
s.name = "xiaoming";
s.id = "9527";
people p = new people();
p.name = "xiaohua";
p.age = 15;
p = s; //子类赋值给父类
Console.WriteLine("+++++++ppp++++++>"+p.name+" "+p.age);
}
}
class people
{
public string name;
public int age;
}
class student : people
{
public string id;
}
面对对象三大特性
最新推荐文章于 2022-04-15 23:41:38 发布