Minor: some spelling errors corrected.
A C++ example seems more appropriate.