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

12/2/2019 9:46:37 AM

Eyob

6 Answers

New Answer

+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

+3

One example of operator overloading is for doing some maths operations like +,×,÷,/etc b/w user defined datatypes like class struct.

+3

Thank you everybody you help me so much, now i understand it, keep up a good work!! Thanks

+1

In "More On Classes" chapter https://www.sololearn.com/learn/CPlusPlus/1901/

+1

+1

How we can know the problem solve in function