using System;
namespace test
{
class Animal
{
public void Eat()
{
Console.WriteLine("Animal eating");
}
}
class Man : Animal
{
public new void Eat() //继承后重写 Eat 使用new
{
Console.WriteLine("Man eating");
}
public sealed void Walk() //封装Walk方法,继承后不能重写
{
Console.WriteLine("Man Walk !");
}
}
class Program
{
static void Main()
{
Man q = new Man();
q.Eat();
}
}
}