How to add event listners / signals to a simple superman class?

Posted by Kabumbus on Stack Overflow See other posts from Stack Overflow or by Kabumbus
Published on 2011-01-08T16:46:16Z Indexed on 2011/01/08 16:54 UTC
Read the original article Hit count: 346

Filed under:
|
|
|
|

I can and would love to use boost or std for this. Sorry - I am new to C++. So I created a really simple program like:

#include <iostream>
#include <string>
using namespace std;

class superman
{
public:
  string punch(){return cout << "superman: I hit the bad guy!" << endl;};
};

int main()
{
  superman clark;
  clark.punch();
  cin.get();
}

I want to add an event listner that would tell me when clark punched and cout something like "superman punched!". How to add such event listner and event function to my class?

© Stack Overflow or respective owner

Related posts about c++

Related posts about oop