Sign in to follow this  

api independent...

This topic is 4482 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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<A> as; // bad!
std::vector<B> bs; // ok
std::vector<A*> pas; // also ok

pas.push_back(new B);



Without seeing handlemanager, I'm guessing it's a similar situation as the vector in my example.

Share this post


Link to post
Share on other sites

This topic is 4482 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this