在衍生类中的方法上使用new和override关键字有何意义,可以通过一系列问题来找到答案。先看一段代码: 1 class Program 2 { 3 static void Main(string[] args) 4 { 5 Child c ...
在衍生类中的方法上使用new和override关键字有何意义,可以通过一系列问题来找到答案。先看一段代码:
1 class Program 2 { 3 static void Main(get='_blank'>string[] args) 4 { 5 Child c = new Child(); 6 c.Func(); 7 8 Console.Read(); 9 }10 }11 12 class Parent13 {14 public void Func()15 {16 System.Console.WriteLine("parent");17 }18 }19 20 class Child : Parent21 {22 }
原标题:C#中的new和override
关键词:C#
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。