0
Need of overloaded & operator
Why would one overload & operator? Refer class Test1 and we have made address of private member available to user. Isn't this dangerous situation and violates OOPS? I am more curious to know its elegant usage to have idea of importance of & operator overloaded https://sololearn.com/compiler-playground/c9P4sUwRNLgP/?ref=app
2 Answers
+ 1
It is dangerous
I've never seen any logical instance to overload it except if you want to manipulate or give custom addresses ofc
0
True. C++ allow many things which are dangerous and should not be done intentionally
However, just concerned why it has been provided. Definitely some good scenario it is handling and curious to know what is that