9.8. Time Class Case Study: A Subtle Trap—Returning a Reference or a Pointer to a private Data Member
A reference to an object is an alias for the name of the object and, hence, may be used on the left side of an assignment statement. In this context, the reference makes a perfectly acceptable lvalue that can receive a value. One way to use this capability is to have a
public member function of a class return a reference to a
private data member of that class. If a function returns a reference that is declared
const, the reference is a non-modifiable lvalue and cannot be used to modify the data.