Const
1. Const member functions cannot modify the status of member variables (that is, the value of member variables cannot be modified); const objects cannot call non-const member methods, if you want to modify the state of a member variable in the const member function, you can add the mutable keyword when declaring the variable.
2. a const reference can only point to a const variable (I .e. a constant ),
Const int n = 11; const Int & ref = N; -------> OK,
Int & ref = N; ------------------------------------------> Error
Const int * P const appears on the left side of *, which indicates that * P is a constant, that is, the content pointed to by the pointer P cannot be modified * P = 22; ----------> Error
Int * const P const appears on the right side of *, indicating that p is a constant. P cannot be modified. P = & N; -------------- <Error
Const int * const P indicates that both P and * P are constants.
3. In the class, if a const member variable has been initialized, it can only be initialized in the const initialization list.