我知道什么时候用
int func() const;
then we cannot modify anything in the function except for mutable variable. But when i used
const int func();
它允许我修改任何东西吗?
最佳答案
const int func();
是返回 const int
和
int func() const;
是 const
函数,即不修改对象状态的函数,它已被调用。
关于c++ - const int function(); 之间的区别和 int func() 常量;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19471098/