CPPLearning: chapter 9 example code