C++ defines type qualifier that the data member or member function or object can only have read-only access or read-write access. If the data member or member function or object is followed by qualifier const then it is having only read-only access. And it is not possible to alter the data member using object or member function.
Actually const qualifier is used to prevent the data member from modification in the program.
Example:
const int x = 5;
No comments:
Post a Comment