An implementation of the observer pattern in C++