0
I didn't actually understand what is use of operator overloading?
2 Respostas
+ 3
Operator overloading is kind of operator customization... You can write custom methods for using operator with custom data: if you define a custom class 'Thing', compilator don't know how to handle:
Thing instance1;
Thing instance2;
Thing instance3 = instance1 + instance2;
( this is the same as the @Dean implicit example )
If you have overloaded operator +, compilater will know what to do for handle it ^^
+ 2
It's syntactic sugar; rather than writing vec1.add(vec2) you get to use the more intuitive vec1+vec2