隔代访问??
class MyBase
{
public void Fun1()
{
Console.WriteLine("base");
}
}
class MyDerived : MyBase
{
new public void Fun1()
{
Console.WriteLine("Derived");
}
}
class MyDerived2 : MyDerived
{
public void Fun5()
{
base.Fun1();???????如何访问Mybase中的Fun1()??????
}
}
------解决方案--------------------C# code
class MyBase
{
public void Fun1()
{
Console.WriteLine("base");
}
}
class MyDerived : MyBase
{
new public void Fun1()
{
Console.WriteLine("Derived");
}
}
class MyDerived2 : MyDerived
{
public void Fun5()
{
((MyBase)this).Fun1();
}
}