i'm pretty new to c++ i usually code in c# but i wanted to learn more about c++ so i'm writing a small game. i want to make it able to render in directx and opengl, and if i wanted to do something like that i would do something like this in c#
Use a static_cast only if you are sure the IRender pointer is pointing to an instance of the target class; otherwise use dynamic_cast, which is allowed to fail (in the pointer case, the result of the cast is a null pointer if the class of the object pointed to is not the one that is wanted).