add cpp version observer pattern