标签:
public class Program { static void Main(string[] args) { A a = new A(); a.Test(); B b = new B(); b.Test(); A c = new B(); c.Test(); A d = new C(); d.Test(); Console.ReadLine(); } } public class A { public virtual void Test() { Console.WriteLine("A Test()"); } } public class B : A { private new void Test() { Console.WriteLine("b Test()"); } } public class C : B { public override void Test() { Console.WriteLine("C Test()"); } }
标签:
原文地址:http://www.cnblogs.com/liujie2272/p/5407628.html