I have the following scenario :-
template <typename T>
class Base {
public:
virtual void someFunc() {}
};
class Derived : public Base<int>,
public Base<float> {
public:
virtual void someFunc() {
// do something different if Base<int> than if Base<float>
}
};
Derived *d = new D();
Base<int>* b1 = (Base<int>*) d;
Base<float>* b2 = (Base<float>*) d;
b1->someFunc();
b2->someFunc();
I want to be able to distinguish between these two function calls. Or in other words, over-ride the two base functions with different function bodies.
You could use a shim (this works for any instance of name collisions between base classes, whether template-related or not):