C# 继承方法重写调用测试
1 class BaseClass 2 { 3 public virtual void run() 4 { 5 Console.WriteLine("base run func...."); 6 } 7 } 8 class SubClass : BaseClass 9 { 10 public override void run() 11 { 12 Console.WriteLine("sub run func...."); 13 base.run(); 14 } 15 } 16 class Program 17 { 18 static void Main(string[] args) 19 { 20 BaseClass bass = new SubClass(); 21 bass.run(); 22 Console.ReadKey(); 23 } 24 }