Is returning references of member variables bad practice?
问题 The below is said to be better then having first/second as public members. I believe this is nearly as bad. If you're giving a way to access a private variable outside of the class then whats the point? Shouldn't the functions be T First(); void(or T) First(const T&) Sample: // Example 17-3(b): Proper encapsulation, initially with inline accessors. Later // in life, these might grow into nontrivial functions if needed; if not, then not. // template<class T, class U> class Couple { Couple() :