using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 对象接口
{
interface IHello
{
void Hello();
}
class Base : IHello
{
public void Hello()
{
Console.WriteLine("Hello in Base!");
}
}
class Heaven : Base
{
public new void Hello()
{
Console.WriteLine("Hello in Heaven");
}
}
class Program
{
static void Main(string[] args)
{
IHello h = new Heaven();
h.Hello();
Base b = new Base();
b.Hello();
Heaven heaven = new Heaven();
heaven.Hello();
Console.ReadKey();
}
}
}
输入结果: Hello in Base!
Hello in Base!
Hello in Heaven!
原理的话,有时间补上。