implement callback mechanism only in C++