For the following code to overload the [] operatior in a user defined templated class implementation of HashTable :
Will “return *f;” return the variable by refernce ? Shouldn’t it simply be the value pointed by f ?
For the following code to overload the [] operatior in a user defined templated class implementation of HashTable :
Will “return *f;” return the variable by refernce ? Shouldn’t it simply be the value pointed by f ?
Hey @Yash5646
Yes this is true but see the return type its T& which means we are returning reference to that value
so any change done on it reference alias will be reflected back
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.