Implementing interfaces in C++-Collection of common programming errors
As others have noted, the two functions in the base classes are unrelated (despite having the same name and argument types), as they have no common base class. If you want them to be related, you need to give them a common base class.
Also, in general, if you want multiple inheritance to work properly, you need to declare your non-private base classes as virtual. Otherwise, if you ever have common base classes (as you often need for this style of code), bad things will happen.
So given that, you can make your example work as follows:
template
class IDoSomething {
public:
virtual void DoSomething(T value) = 0;
};
template
class Base : public virtual IDoSomething
{
public:
virtual void DoSomething(T value)
{
// Do something here
}
};
class IDoubleDoSomething : public virtual IDoSomething
{
};
class Foo : public virtual Base, public virtual IDoubleDoSomething
{
};