I'm having some problems with multiple inheritance, in my case where the hiearchy first splits then joins again. Ok, first some background. I'm working on a DLL so I need pure virtual interfaces for each class. In one case I have one base class and several classes inherited from that one, call them
Code:
class IBase
{
public:
virtual void Stuff() = 0;
};
class ISub1 : public IBase
{
public:
virtual void Junk() = 0;
};
class ISub2 : public IBase
{
... //etc...
};
The base class has a (in the DLL hidden) implementation:
Code:
class CBase : public IBase
{
public:
virtual void Stuff()
{
//Implementation
}
};
The sub class also has an implementation, but here lies the problem, I don't want to redefine the implementation of Stuff() but use the one defined above so I inherit from CBase too.
Code:
class CSub1 : public ISub1, public CBase
{
public:
virtual void Junk()
{
//Implementation
}
};
But alas the compiler does not like this and thinks CSub1 is still an abstract class and cannot be instantiated.
So, my question is (I guess), how can I solve this? I don't want to redefine Stuff() in every subclass I derive.