I'm creating a class that handles models used for loading meshes and textures. When my engine goes to draw these models, it looks to an array of pointers that point to each model that's been initialized. How do I make the model class put a pointer to itself in this array? I've tried the "this" tag with no luck. Any ideas?
Model class stores pointer to itself
Nevermind, I tried using this again and It worked. After months of dealing with this I finally decide to post and it suddenly starts working. I guess I should start posting more often.
Alright, I have another question.
If the array used to store these pointers was a static member of Model,
could I use it's constructor to add a pointer to itself in this array?
Yup. You can access static members from non static member functions. You can't do it the other way around though (unless the static member gets an object of the class type as an argument, or makes one that is used in the function, of course).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement