public class Processer
{
public virtual string Test()
{
return
"virtual";
}
public string
Test2()
{
return
"father";
}
}
public class Processer2 :
Processer
{
public override
string Test()
{
return
"override";
}
public string
Test2()
{
return
"son";
}
}
Processer2 p=new Processer2();
p.Test()为"override" p.Test2()为"son"
Processer p=new Processer2();
p.Test()为"override" p.Test2()为"father"
Processer p=new Processer();
p.Test()为"virtual" p.Test2()为"father"
原文地址:http://www.cnblogs.com/langdaren/p/3744948.html