If a member function of a class does not alter any data in the class, then this member function may be declared as a constant function using the keyword const.
Consider the following declarations:
int max(int,int) const; void prn(void) const;
Once a function is declared as const, it cannot alter the data values of the class. The complier will generate an error message if such functions try to change the data value.
About our authors: Team EQA
You have viewed 1 page out of 62. Your C++ learning is 0.00% complete. Login to check your learning progress.
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average