Implementation of a counter in C/C++ using the Observer Pattern