Refactoring for c++ style