thanx I changed my class again so my pointer to a VB is now a private member and all works fine now
anything I should worry about when using a pointer as a private member?
trying to make a class that makes quads
As stated in my post above, when dealing with a private member that is a pointer to an external variable you could run into the danger of having the external destroyed, invalidating the private pointer. However, the class would know nothing of the object''s demise and would continue to use the pointer as if it was valid which will cause your program to barf.
In my sprite class I use this method and then just assume that the user of the class will be smart enough to stop using/re-initialize the class when the pointer becomes invalid. I also give the user the option to have the sprite class manage itself instead. While this is less efficient than the former choice (each sprite has it''s own tiny vb), it does give a bit of automation.
So, as always when working with pointers, you just need to be careful.
*Side note*
If you use ATL, there is a class to help manage COM pointers, CComPtr. You may also want to look into that
The hackers must have gotten into the system through the hyperlink!!
Invader''s Realm
In my sprite class I use this method and then just assume that the user of the class will be smart enough to stop using/re-initialize the class when the pointer becomes invalid. I also give the user the option to have the sprite class manage itself instead. While this is less efficient than the former choice (each sprite has it''s own tiny vb), it does give a bit of automation.
So, as always when working with pointers, you just need to be careful.
*Side note*
If you use ATL, there is a class to help manage COM pointers, CComPtr. You may also want to look into that
The hackers must have gotten into the system through the hyperlink!!
Invader''s Realm
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement