使用base调用父类中的虚方法。
class School { private string _name; public School(){ } public School(string name) { _name = name; } public virtual void Method_virtual() //虚方法 { Console.Write(_name + ":"); } } class Teacher : School { public Teacher(string name):base(name){ } public override void Method_virtual() { base.Method_virtual(); Console.WriteLine("给学生们上课!"); } } class Student : School { public Student(string name) : base(name) { } public override void Method_virtual() { base.Method_virtual(); Console.WriteLine("同学上台演讲!"); } } class Monitor : School { public Monitor(string name) : base(name) { } public override void Method_virtual() { base.Method_virtual(); Console.WriteLine("班长上台预留课后作业!"); } } class Program { static void Main(string[] args) { School[] school = new School[4]; school[0] = new Teacher("李老师"); school[1] = new Student("王二"); school[2] = new Student("张三"); school[3] = new Monitor("刘四"); Console.WriteLine("上课铃声响了!"); foreach (School s in school) { s.Method_virtual(); } Console.ReadKey(); } }