Jump to content

  • Log In with Google      Sign In   
  • Create Account


Model class stores pointer to itself


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 CatmanFS   Members   -  Reputation: 187

Like
0Likes
Like

Posted 25 November 2013 - 03:14 PM

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, 25 November 2013 - 03:16 PM.


Sponsor:

#2 CatmanFS   Members   -  Reputation: 187

Like
0Likes
Like

Posted 25 November 2013 - 03:23 PM

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



#3 CatmanFS   Members   -  Reputation: 187

Like
0Likes
Like

Posted 25 November 2013 - 03:35 PM

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?



#4 Paradigm Shifter   Crossbones+   -  Reputation: 5251

Like
0Likes
Like

Posted 25 November 2013 - 04:10 PM

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


"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS