public class MyClass
{
public class Animal
{
public virtual void Eat()
{
Console.WriteLine("I eat like a generic Animal.");
}
}
public class Wolf : Animal
{
public override void Eat()
{
Console.WriteLine("I eat like a wolf!");
}
}
public static void Main(string[] args)
{
Wolf wolf = new Wolf();
/*
如何能用OBJECT wolf 调用其BASECLASS Eat() PRINTOUT “I eat like a generic Animal”,HINT:由于Eat() method 是OVERRIDE的POLYMORPHISIM,CASTING BACK TO BASECALSS won't work. 有人愿意试试吗?
*/
}
}