C++: Refactor declaration