#include <iostream>
using namespace std;
class Iface {
public:
void stop() { cout << "Stop" << endl; }
void run() { cout << "Run" << endl; }
void resume() { cout << "Resume" << endl; }
void suspend() { cout << "Suspend" << endl; }
};
typedef void ( Iface::*Operation ) ();
class Worker
{
public:
Worker( Iface* i ) : iface(i) {}
void doIt( Operation op ) { (iface->*op) (); }
private:
Iface* iface;
};
void main()
{
Iface* i = new Iface();
Worker w( i );
w.doIt( &Iface::run );
w.doIt( &Iface::stop );
Operation op = &Iface::resume;
w.doIt( op );
delete i;
}