标签:bsp struct space dos text lin rtu system class
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConstructCallVirtual { class Program { static void Main(string[] args) { B b=new B(); } } class A { public A() { Console.WriteLine("A()"); DoSth(); } public virtual void DoSth() { Console.WriteLine("A::DoSth()"); } } class B:A { public B() { Console.WriteLine("B()"); DoSth(); } public virtual void DoSth() { Console.WriteLine("B::DoSth()"); } } //A() //A::DoSth() //B() //B::DoSth() // }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConstructCallVirtual { class Program { static void Main(string[] args) { B b=new B(); } } class A { public A() { Console.WriteLine("A()"); DoSth(); } public virtual void DoSth() { Console.WriteLine("A::DoSth()"); } } class B:A { public B() { Console.WriteLine("B()"); DoSth(); } public override void DoSth() { Console.WriteLine("B::DoSth()"); } } //A() //B::DoSth() //B() //B::DoSth() // }
标签:bsp struct space dos text lin rtu system class
原文地址:http://www.cnblogs.com/sky20080101/p/6814063.html