C++: setTypes method to Obj