Observer implementation c++