Operator overloading | Sololearn: Learn to code for FREE!
+ 2

Operator overloading

What is the main purpose of operator overloading in c++ or any other programming language? Any examples that can only be done using overloaded operator

2nd Dec 2019, 9:46 AM
Eyob
Eyob - avatar
6 Respuestas
+ 7
Operator overloading is not needed, but make things clearer. Instead of many function calls with your class variables: d.plus(e).times(f), you can code: (d+e)*f. Here is a simple example of using it. It includes links to similar code in other languages. https://code.sololearn.com/cStdw0OPtPxG
2nd Dec 2019, 6:45 PM
John Wells
John Wells - avatar
+ 3
One example of operator overloading is for doing some maths operations like +,√ó,√∑,/etc b/w user defined datatypes like class struct.
3rd Dec 2019, 7:58 AM
RKK
RKK - avatar
+ 3
Thank you everybody you help me so much, now i understand it, keep up a good work!! Thanks
3rd Dec 2019, 8:46 AM
Eyob
Eyob - avatar
+ 1
2nd Dec 2019, 11:38 AM
Ipang
+ 1
Hello
4th Dec 2019, 3:36 AM
Waleef Malaeb
Waleef Malaeb - avatar
+ 1
How we can know the problem solve in function
4th Dec 2019, 3:38 AM
Waleef Malaeb
Waleef Malaeb - avatar