title: A kind of addeventlistener in c++
body: <p>I think it doesn't exists in c++ but it would be very convenient.
  Say I have a class:</p>
  
  <pre><code>class SPRITE
  {
      void RunTo(POINT pt);
      SPRITE(MAINCLASS* main);
  }
  </code></pre>
  
  <p>And a main function:</p>
  
  <pre><code>SPRITE sprite=new SPRITE();
  while(1)
  {
      GetCursorPos(&amp;pt);
      FrameMove(frame,pt);
  }
  </code></pre>
  
  <p>So if I want to call <code>SPRITE::RunTo</code> with the cursor position I need to call it from the main loop which is simple with one class but less with many.</p>
  
  <p>The good thing I'm thinking about is something like that:</p>
  
  <pre><code>SPRITE::SPRITE(MAINCLASS* main)
  {
      main-&gt;AddListener(main::Framemove(int frame,POINT pt){ RunTo(pt); });
  }
  </code></pre>
  
  <p>It's a pure invention but maybe there's something that can do the same ?</p>
  
  <p>Thanks</p>