Answer the question
In order to leave comments, you need to log in
Why use const qualifier in return value?
Good evening.
Everything is clear here: we promise the compiler not to change the object, we return the same that we get (a reference to the object), we forbid changing the structure of the incoming object
. Only the purpose of the following prototype is not clear:
Namely, the first qualifier. What for in return to specify the qualifier const? String& String::test(const String&)const;
const String& String::test(const String&)const;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question