C++ approach