Confusion in return type datatype

can we use return type as T* in operator overloading

hi @neerav

you can return anything you want
if you return T*
means you are returning a pointer to that bucket
now in main you can only access that bucket and to change its value you have to derefer it like

     cout<<*h["Guvava"];
	*h["Guvava"]+=32;
	cout<<*h["Guvava"]<<endl;

but this is not looking cool
so best way is to return that bucket (by reference) so that you need not to derefer that bucket again in main()

i hope this helps

if you have more doubts regarding this feel free to ask
and if your doubt is resolved please mark it as resolved

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.