Constants
Read pointer or Reference Parameters with const
params backwards:
Employee * const e
- Constant pointer to
e
. Pointer cannot be changed, but the object can be.
- Constant pointer to
Employee const * e
- Pointer to a constant
Employee
. Object can't be changed, pointer can be.
- Pointer to a constant
Employee * const * e
- Both the pointer and object are constant.
But const Employee & e
is how you declare a constant reference parameter. e is a reference to a const employee.