用new重载,用override 重写 比如:父类中public virtual void run(),无参数;子类中重载 public new void run(string a,int b)子类中重写public overridevoid run()
使用父类的作用域来调用同名方法。比如:class Base { public:void Show(){ cout << "Base:Show!" << endl;} } class Child : public Base { public:void Show(){ cout << "Child:Show!" << endl;//调用父类同名方法 Base::Show();} } ...
虚方法能否实现我不知道,不过用抽象可以实现,把父类写为抽象类,方法也写成抽象方法,子类中要重载几个方法,就定义几个抽象方法:public abstract class a { public abstract void fuction1();public abstract void fuction1(string s);} public class b : a { public override void fuction1(...