I'm extending a class provided by a third part library. The class, let's call it Foo
, has a reset()
method which can be called in order to restart Foo
's behavior. The reset()
method is also used internally by the class.
class Foo
{
public:
void reset () {
/* ... */
}
void something () {
reset();
}
};
So far, I need to overload the reset()
method in order to reset my additional features as well:
class Bar : public Foo
{
public:
void reset() {
/* ...something... */
Foo::reset();
}
};
Unfortunately, since the Foo::reset()
method is not virtual, by calling Bar::something()
I get the Foo::reset()
method called instead of Bar::reset()
.
Is there a way (different from overloading Foo::something()
as well) to make it backward-virtual?