Hi,
I'm facing a problem I can't seem to find a good answer for.
I'm trying to build a wrapper for D3D11 and OpenGL. For this I have some interfaces similiar to D3D11's.
Let's assume these interfaces:
class IDeviceChild;
class IResource : public IDeviceChild;
class IBuffer : public IResource;
Now, what I wish to do, is for each of those interfaces to have their own implementation class, like this:
class oglDeviceChild : public IDeviceChild;
class oglResource : public IResource, public oglDeviceChild;
class oglBuffer : public IBuffer, public oglResource;
Now this obviously won't work like this because of the diamond problem I have here, and the only way to solve it is to have virtual inheritance in the interface classes themselves.
But that leads to another problem! If I have an oglResource, I can't static_cast to an oglBuffer.
It sure must be possible to solve this, since D3D does it (and doesn't use virtual inheritance in the interfaces).
It also looks like virtual inheritance only signals the class being inherited to be virtual, instead of that class plus it's parents...
The only way out I see right now is to avoid multiple inheritance and only inherit the interface, but that doesn't look like a proper solution to me...
Can anybody shed some light?
Thanks in advance.