I am getting below warning . part of my code is :
class Base {
public:
virtual void process(int x) {;};
virtual void process(int a,float b) {;};
protected:
int pd;
float pb;
};
class derived: public Base{
public:
void process(int a,float b);
}
void derived::process(int a,float b){
pd=a;
pb=b;
....
}
I am getting below warning :
Warning: overloaded virtual function "Base::process" is only partially overridden in class "derived"
any way i have made process as virtual function so I am expecting this warning should not come ... What is the reason behind this ??
You have only overriden one of the two overloads of
process. You are missing the overload taking only anint.Depending on what you want, you could:
Simply override the
intoverload too inderived; ormake the
intoverload nonvirtual and let it call the virtualint, floatoverload.Two side notes: (a) Although most compilers accept it, a
;after a function body is syntactically wrong. (b) Protected member variables are generally frowned upon nearly as much as public ones; you should use protected getters/setters and make the variables private.