title: when does a function have to return a reference in c++
body: <p>In c++, under what scenarios do we have to return a reference from a function? I understand using references as function inputs, but for function outputs, why cannot we only return values or pointers?</p>