Skip to main content
GameDev.net gamedev.net
🔒 Locked

api independent...

Started by Thaligar Sep 7, 2005 at 12:28 PM 1 replies 950+ views
Original Post
Thaligar
Thaligar
hi folks, i finally get an api independent texture class to work (multiple inheritance), my brain was some kind of dizzy during the implementation, well now i try to get it to run with the handlemanager from "Games Gems I" and now the problem, the handlemanager tries to create a template object through the std. constr., well not a problem but if i pass as template parameter the texture interface class the compiler hangs, (well not surprising) but how can i get it to run without implementing one handlemanager for each texture (2D, 3D, 1D...), because it works without a problem when i pass as template not the interface class but the specialized class, thanks in advance for your time (for reading this as well as participate), greets tgar
mossmoss
mossmoss
I don't know this particular handlemanager class, but if it is/has a collection of your objects, then the simple answer is you need to store pointers to the interface class, not the interface class itself.

Example:

class A {   int a;public:   virtual int value() const { return a; }};class B : public A {   int b;public:   virtual int value() const { return b; }};std::vector  as;   // bad!std::vector  bs;   // okstd::vector<A*> pas;  // also okpas.push_back(new B);


Without seeing handlemanager, I'm guessing it's a similar situation as the vector in my example.
Thaligar
Thaligar
now i feel a little bit dumb,

thanks,
greets
tgar

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.