class A
{
public string Str = "A";
public void Show() { Console.WriteLine("Show A"); }
}
class B : A
{
public string Str = "B";
public virtual void Show() { Console.WriteLine("Show B"); }
}
class C : B
{
public override void Show() { Console.WriteLine("Show C"); }
}
class D : C
{
public string Str = "D";
public void Show() { Console.WriteLine("Show D"); }
}
class Program
{
static void Main(string[] args)
{
D d = new D();
C c = d;
B b = d;
A a = d;
Console.WriteLine(d.Str);
Console.WriteLine(c.Str);
Console.WriteLine(b.Str);
Console.WriteLine(a.Str);
Console.WriteLine("------------");
d.Show();
c.Show();
b.Show();
a.Show();
Console.ReadLine();
}
}
各位大仙,帮我分析下这个流程怎么走吧!我快疯了…… |
|