Skip to main content

Constant members and Objects

Body

Constant members and Objects

In this part you will learn: 1. What are constant data members and functions 2. How to use them 3. Syntax in c++ 4. Program 5. Output Constant data members Constant data members are the data members of a class which once initialized, cannot be changed during any part of the program. Constant data members are declared just like normal data member declaration, the only difference is that we add a keyword ‘const’ before it. Constant data members help the programmers to perform checking of a program, they declare the members constant which they don’t want

Add new comment