日期:2014-05-17 浏览次数:20931 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConstDomain;
namespace CLRConst
{
public class A
{
public virtual void Print()
{
Console.WriteLine("A Print");
}
}
public class B : A
{
}
public class C : B
{
public override void Print()
{
Console.WriteLine("B Print");
}
}
class Program
{
static void Main(string[] args)
{
A a = new A();
a.Print(); //IL代码:callvirt instance void CLRConst.A::Print()
A b = new C();
b.Print();//IL代码:callvirt instance void CLRConst.A::Print()
C c = new C();
c.Print();//IL代码:callvirt instance void CLRConst.A::Print() 这里有不理解
Console.Read();
}
}
}