Returning const References

Learn about the const returning by references.

What about returning const references?

Sometimes, newer developers return const references just to be symmetric with the well-known best practice of taking class type arguments by const reference. However, this can cause a few issues.

What is the problem?

The problem with returning const references is that the returned object has to outlive the caller. At least it has to live as long as the caller ...