A base class for handling events in C++