Constant member functions are those functions that can not modified the object state. Constant member functions are “read only”. Constant data member function can not change data member. To declare a constant member function, place the const keyword after the closing parenthesis of the argument list. The const keyword is required in both the declaration and the definition.
Syntax:
class className{
returnValue Function() const;
};
Definition:
returnValue className:: function() const{
}
Example:
class Student{
public:
int getRollNo() const {
return rollNo;
}
};