When do we say that a function is const ?
Use of the keyword const
const functions are used inside the class as a const member function and is used to access data members of a const instance of the class i.e. a const object,an object declared as const cannot be modified and hence, can invoke only const member functions as these functions ensure not to modify the object.
A function becomes const when the const keyword is used in the function’s declaration. The idea of const functions is not to allow the function to modify the object on which they are called.
refer this link for some examples :-
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.