• Advertisement
Sign in to follow this  

Model class stores pointer to itself

This topic is 1520 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

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?

Edited by CatmanFS

Share this post


Link to post
Share on other sites
Advertisement

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. wacko.png

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement