I have the following:
class Parent {
public:
virtual bool foo(vector<string> arg1, vector<string> arg2) = 0;
};
class Child : public Parent {
public:
bool foo(vector<string> arg1, vector<string> arg2);
};
bool Child::foo(vector<string> arg1, vector<string> arg2) {
return false;
}
There is no parent implementation of foo (...) because it is a pure virtual function. The parent says foo accepts two vector arguments. The child correctly implements it with two string arguments, but they are not used. HOWEVER, some children of a parent use these arguments to always be there.
Is it possible to use overloading to allow foo in this Child class to have no arguments, even if the parent says it should?
Many thanks.
source
share