an over-engineered C++ learning exercise