可不可以达到这种效果,继承相关问题 class a { public void show(){console.write("this is ")} } class b:a { public void show(){console.write("a demo")} } 输出结果 this is a demo
可以么?
------解决方案--------------------
C# code
class A
{
public virtual void Show(){ Console.Write("this is "); }
}
class B:A
{
public override void Show(){
base.Show();
Console.Write("a demo");
}
}
------解决方案-------------------- 一楼正解!
------解决方案--------------------