+ 1
Overloading in c++
Why we can't overload '=' by using frnd fn?
1 Odpowiedź
+ 5
It is because assignment operator is one of the "special member operator" in C++ ( special member functions are the functions which are generated by compiler if it doesn't find one at the time of its use )
If you attempt to overload it via friend function, then your definition would conflict with compiler generated definition causing ambiguity ( resulting in compilation error )