这里面暂且不管其他代码.
如果getName()是下面的写法:
则成员this->name也会带上const 属性(应该const属性只存在这个函数中)
结果会在DEV-CPP中导致如下的编译问题:
invalid initialization of reference of type 'std::string&' from expression of type 'const std::string'
意思就是说,返回getName的类型是string&而不是const string类型.不能将const string 类型的
this->name赋给string&类型的返回变量(个人感觉 所谓返回类型只是一个名字被隐藏的变量)