Quote:Original post by GrainQuote:Original post by DaeLook up the Bridge design pattern.
Haha, alright thanks man. Its too bad theres no like generic pointer that would point to D3D or OGL even though they are different classes. Deriving them from the same class works.. but eh wouldn't that be a little high maintenance.
If anyone knows of another way too I'd really appreciate it! :)
The bridge pattern is implemented by defining something like this:
class Abstraction{private: Implementation *mImplementation;public: void doSomething() { mImplementation->doSomething(); }};class Implementation // abstract class{public: virtual void doSomething() = 0;};
And then you inherit Implementation to provide yours. Of course, you are also able to inherit Abstraction in order to create some other abstraction, but that's not the point here. In fact, the bridge pattern is only interesting when you inherit Abstraction and then modify the behavior of the doSomething() method (have a look to the GoF for a more concrete example of this pattern).
The fact is that the OP (Dae) needs to create the Implementation part and its derived classes. Thus, the bridge pattern will not really be usefull in this case.
Of course, the advise is still good: the more pattern description you read, the faster you'll progress in OO design ;)
Regards,