const string getName() const;
前边的const 说明返回的值不能被修改
后边的const 说明该方法只能读取类中的变量,而不能修改类中的变量
c++ 方法后面加 const
原文:http://www.cnblogs.com/trevor/p/3521670.html