I am not up to c-proficiency yet to understand what you mean.  Do you mean put 
these features/pattern into the class and make them static?

  displayable* myWin := NULL
  void myWinReshapeWrapper (int h, int w) {
    myWin->onReshape;
  };

In this pattern the reference to myWin represents the state on which to call 
onReshape.  I don't know how I could set the state in that case.  A callback 
would have to be executed on, say a mouse click, to set the "state" to the 
window referenced by myWind, but in order to execute the callback on that 
window I need the stat to already be that window.  Chick-and-egg.

What is "delegate to" a singleton?  I need to instantiate more than one object 
of type displayable so making it a singleton will not work.  Can you explain 
"delegate to a singleton"?

thanks,



--- In [email protected], John Gaughan <j...@...> wrote:
>
> On 1/26/2010 12:53 PM, Jimmy Johnson wrote:
> > To boil it down, I want to create new functions to be used as callbacks 
> > which will call a c++ method on the correct object.
> >    
> 
> How about using static members of a class that either deal with static 
> state or delegate to a singleton?
> 
> -- 
> John Gaughan
> http://www.jtgprogramming.org/
>


Reply via email to