JesseC
- 247
- 2
The use of 'const' in functions seems to be an endless source of confusion. Am I right in thinking that in this case:
double functionName(class const & parameter) {...}
the const specifies that the reference to the class being fed into the function may not be modified?
And that in this case (where the function is a member function of a class):
double functionName(class const & parameter) const {...}
the two const's specify that the reference to the class being fed in may not be modified AND that any member data may also not be modified?
double functionName(class const & parameter) {...}
the const specifies that the reference to the class being fed into the function may not be modified?
And that in this case (where the function is a member function of a class):
double functionName(class const & parameter) const {...}
the two const's specify that the reference to the class being fed in may not be modified AND that any member data may also not be modified?