覆盖父类以上的这个方法public new string testa()
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ClassLibrary1 { public class Test { public string testa() { return "testa父类"; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ClassLibrary1 { public class Test2cs : Test { /// <summary> /// 覆盖父类以上的这个方法 /// </summary> /// <returns></returns> public new string testa() { return "testa子类"; } } }


浙公网安备 33010602011771号