appel all instances of a class
i'm new here and have a (banal) question:
i'm creating a GUI-enviroment with opengl and have a button-class.
i want to do a button-click-test, but i need a method to say to this function that it has to check EVERY created instance of this button-class.
i tried to find something via google, but nothing.
does anybody know a solution?? for instance with dynamic reservation??
thank you very very much in advance
ps: i need only the general answer, i've already created the graphics function.
**if it will work i'll post my project for all***
super-beautiful buttons ;-)
Re: appel all instances of a class
It's possible to track all created instances of a class using a static class member which gets manipulated in the constructor(s) and destructor. Don't forget you'll need to explicitly define the copy constructor if you haven't already, and thread safety is going to be an issue.
However, if I were faced with such a requirement I would seriously re-think my design, as such things are usually an indication that something is wrong with it.