Advice: Don't do this. It is a complete waste of time. You will have to rewrite your engine after the 1st time doing this. If you're just starting out in graphics development, wasting time with low level API functionality equivalences is not going to teach you much, it's just going to be very tedious work.
That said, if you have to, then design a bunch of abstract interfaces to interact with a graphics API. THen write concrete classes underneath that, that actually interact with the specific API chosen.
Examples are: abstract classes for
Surface (frame buffer in OpenGL, surface in D3D). You then write concrete implementation classes
D3DWindow : public GraphicsWindow,
OpenGLWindow : public GraphicsWindow.
Example of a method: In
GraphicsWindow you would provide a pure virtual method
void flipBuffer()=0. Implementation would be different for OGL and D3D, and the implementation code would be in their respective classes.