2 ms·
Operator overloading is a syntactic sugar trick that hides the real method call. Nothing more, nothing less. It's useful in vector math, complex number math, m
by vardump 12y ago
Operator overloading is a syntactic sugar trick that hides the real method call. Nothing more, nothing less.
It's useful in vector math, complex number math, matrix math.
- TheCoelacanth 12y agoOperator overloading is useful for a lot more than just math. Overloading * and -> is useful for pointer-like types. Overloading () is useful for function-like types. Overloading [] is useful for collections and overloading ++ and -- is useful for iterators.
- SamReidHughes 12y agoThe overloading of (), [], and the like is used but it's not necessary. They could have been other named overloaded functions.