You need to override it. There is no other way to specify a different default argument. But you can keep the implementation trivial just by calling the base version:
class Base{
public:
void foo(int val){value=val;};
protected:
int value;
};
class Derived : public Base{
public:
void foo(int val=10) { Base::foo(val); }
};
class Derived2 : public Base{
public:
void foo(int val=20) { Base::foo(val); }
};
Angew source
share