Original Post
I may be going around this design the wrong way but really my question is just on casting.
I have a CAbstractRenderer class that encapulates the behaviour of a Rendering API such as OpenGL or DirectX.
I have derived classes, that override some virtual functions, these are called COpenGLRenderer and CDirectXRenderer;
Now, in my other classes through out the system I have various Interfaces such as ICamera, IPanel that have 2 derrived classes which are the opengl and directx equivalents of the interfaces.
For example, because my directx camera class needs to set up its view matrices etc using the IDirect3DDevice9 interface I''d like to get access to this, this is in my CDirectXRenderer and there will be a specific function for it to return an IDirect3DDevice9*.
But, my main game engine just has a pointer to a CAbstractRenderer.
Can I just do this if ..
CAbstractRenderer* myRenderer = new CDirectXRenderer();
from my camera class (or whatever) I get the myRenderer and
CDirectXRenderer* localRenderer = dynamic_castmyRenderer;
I want to try use proper c++ casts throughout my code too, not just standard c ones.
Thanks