Let's say I have:
class Foo{
void method();
}
And then I create:
class Bar : public Foo{
}
Where Bar has a lot of methods. Is there any clever way I can force all methods defined in Bar to call method() from Foo?
The reason I wish to do this is for some clever memoization. For certain function calls in Bar there can be some pre-processing to speed up future calls of that class by calling method(), thus I want to make a parent class Foo that invisibly handles the memoization, while the subclasses can happily and blindly focus purely on function definitions.