I didn't get it... how can an oerator be overloaded? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I didn't get it... how can an oerator be overloaded?

15th Mar 2016, 2:45 PM
Praman Kasliwal
Praman Kasliwal - avatar
1 Answer
+ 3
For example lets say the "+" operator. You can add int objects ( like 2+2, or 10+42) but if you have Person objects , you can't add them because "+" operator was not build to do that. In that case you overload the "+" operator to add your two Person objects .
1st Apr 2016, 9:56 AM
Frincu Alexandru
Frincu Alexandru - avatar