可能重复:
What does const mean following a function/method signature?当你的函数名和输入后面有“const”时,这意味着什么?
来吧笑我,但到底是什么功能后的常量说明什么?
int someFunc() const{ //<<----notice the const
//insert code blah...
}
如果我想const int的返回类型不会我只是写
const int someFunc(){
//code....
}
我想说它也是重复的。我不知道我在寻找什么,这是一种晦涩难懂的寻找 – vvMINOvv
顺便说一句,返回类型“int”和“const int”是100%相同的。编译器会忽略标量返回类型的顶级'const'。 – fredoverflow
实际上是有道理的,谢谢@FredOverflow – vvMINOvv