CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2011

    Wink 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 ;-)

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Seattle, WA

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width