add init function in c++