类的继承

using System;
class horse
{
public virtual string run()
{
return ("horse run
");
}
}
class qianliHorse:horse
{
public override string run()
{
return ("Qian li horse run
");
}
}
class HanxueHorse:qianliHorse
{
// public override string run() //注释此处会怎样?
// {
// return ("Hanxue horse run
");
// }
public new string run()
{
return ("NEW Hanxue horse run
");
}
}
class myApp
{
static void Main_83()
{
HanxueHorse h = new HanxueHorse(); //替换horse为HanxueHorse如何
Console.WriteLine(h.run());
}
}
/*
NEW Hanxue horse run
* */

浙公网安备 33010602011771号