I have encountered a question which asks about Given the declaration:
void X::mf(Y &y);
Question a: How would you change the declaration to declare that the operation of this function will not change the state of the object invoking it?
Question b: What can you do with the re-declared function that you could not do in its original form?
For Question a: I think the answer is using const keyword. something like
void X::mf(Y &y) const;
Can some one please tell me if I answered Question a) correctly. And if yes, What could be the answer for Question b).
I understood the const part but could not understand what we can do with the re-declared function that could not be done in its original form.