
If a function should be able to be called on a const object, it should be designated as const.
Use const references or call-by-value for input values Particularly for large (# bytes) values, use references (no copying)
The “const” suffix for a read-only method like getMonth can only appear inside a method declared as a member of a class. It means “read only property” of the object the class defines.
Note that constructors should not be marked as const. This is because const objects should initialize their member variables, and a const constructor would not be able to do so.
When you put "const" in front of a parameter, it means that it cannot be modified in the function. (In other words, you'll get a compile-time error if you try to assign to it.)
Although the const qualifier appears in p’s declaration, it applies only to what p points to, not to p itself. If p were declared as “constpointer to ...” then p would have a const-qualified type.
References allow a function to change the value of the argument, which is sometimes useful. Otherwise, const references can be used to guarantee the function won't change the argument. Because a copy …