title: Is it possible to implement events in C++?
body: <p>I wanted to implement a C# event in C++ just to see if I could do it. I got stuck, I know the bottom is wrong but what I realize my biggest problem is...</p>
  
  <p>How do I overload the <code>()</code> operator to be whatever is in <code>T</code>, in this case <code>int func(float)</code>? I can't? Can I? Can I implement a good alternative?</p>
  
  <pre><code>#include &lt;deque&gt;
  using namespace std;
  
  typedef int(*MyFunc)(float);
  
  template&lt;class T&gt;
  class MyEvent
  {
      deque&lt;T&gt; ls;
  public:
      MyEvent&amp; operator +=(T t)
      {
          ls.push_back(t);
          return *this;
      }
  };
  static int test(float f){return (int)f; }
  int main(){
      MyEvent&lt;MyFunc&gt; e;
      e += test;
  }
  </code></pre>