In C++ an arguments to a function can be declared as constant as shown below:
Int strlen (constant char * p);
Int length (constant string & s);
The qualifier const tells the compiler that the function should not modify the arguments. The compiler will produce error when this situation is violated. This type of declaration is significant only when we pass arguments by reference or pointer.
Constant member functions: If a member function does not alter any data in the class, than we have may declare it as a constant member function as follows:
Void mul (int. Int) constant;
Double get _ balance constant;
The qualifier constant is appended to the function proto types (in both declaration and definition). The compiler is as a constant will generate an error message if such functions try to alter the data values.