接口
IAnimal p = new Manager();
p.ShowMsg();//输出Manager
p = new Person();//输出Person
p.ShowMsg();
Console.Read();
}
interface IAnimal
{
void ShowMsg();
}
class Person:IAnimal
{
public virtual void ShowMsg()
{
Console.WriteLine("Person");
}
}
class Manager:Person
{
public override void ShowMsg()
{
Console.WriteLine("Manager");
}
}
IAnimal p = new Manager();
p.ShowMsg();//输出Person
p = new Person();//输出Person
p.ShowMsg();
Console.Read();
}
interface IAnimal
{
void ShowMsg();
}
class Person:IAnimal
{
public virtual void ShowMsg()
{
Console.WriteLine("Person");
}
}
class Manager:Person
{
public new void ShowMsg()
{
Console.WriteLine("Manager");
}
}