正在加载图片...
方法的隐藏 输出:学生的学号。 public class Person public class Student:Person 隐藏 public void Getlnfo() public new void GetInfo() { Console.WriteLine("name:"+name ) Console.WriteLine("studentID:"+studentID); Console.WriteLine("age:"+age); } Person per new Person("person",50); name:person per.Getlnfo(); age:50 Student stu new Student("student",20,"201209"); stu.Getlnfo(); studentID:201209 继承是子类使用父类的方法4 方法的隐藏 Person per = new Person("person",50); per.GetInfo(); Student stu = new Student("student",20,"201209"); stu. GetInfo(); name: person age:50 studentID:201209 继承是子类使用父类的方法 输出:学生的学号。 隐藏
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有