c#试题-以下代码输出什么
class Father { public virtual void ShowA(int i) { Console.Writeline(i); } public void ShowB(Father a) { a.ShowA(1); ShowA(5); } } class Son : Father { public override void ShowA(int i) { base.ShowA(i + 1); } } static void Main(string[] args) { Father a = new Father(); Son b = new Son(); a.ShowB(a); a.ShowB(b); b.ShowB(a); b.ShowB(b); Console.ReadKey(); }
网友评论0