I have a situation where I need to inherit from two classes with same interface, but to override them separately and I definitely cannot tweak interfaces. See code example below
template<typename T>
struct Foo
{
virtual ~Foo() = default;
virtual void foo() = 0;
};
struct Derived : public Foo<int>, public Foo<double>
{
#if 0 // having something like this would be great, but unfortunately it doesn't work
void Foo<int>::foo() override
{
std::cout << "Foo<int>::foo()" << std::endl;
}
void Foo<double>::foo() override
{
std::cout << "Foo<double>::foo()" << std::endl;
}
#endif
};