updated C++ example to C++11