If I have this class:
class FooBar {
public:
FooBar(int qux);
void bar();
void foo1();
void foo2();
//...
void foo99();
}
How can I overwrite the bar
method in FooBar
, while still being able to use all the other foo
method without defining them again?
Edit:
I want to use like this:
FooBar2 baz(1); // call the constructor of FooBar, FooBar(1)
baz.foo1(); //call method foo1 of original FooBar
baz.bar(); // call method bar of FooBar2
I prefer not to edit the header or implementation of FooBar.
Is it also possible to make the constructor function call the original constructor function from FooBar
?