【发布时间】:2015-10-15 08:39:25
【问题描述】:
在 C++ 中,我很难理解这 3 种使用 const 的方式之间的区别:
int get() const {return x;}
const int& get() {return x;}
const int& get() const {return x;}
我想通过示例进行清晰的解释,以帮助我理解差异。
【问题讨论】:
-
每一本c++基础教科书都已经很好的解释了。