Is returning references of member variables bad practice?
There are several reasons why returning references (or pointers) to the internals of a class are bad. Starting with (what I consider to be) the most important: Encapsulation is breached: you leak an implementation detail, which means that you can no longer alter your class internals as you wish. If you decided not to store … Read more