Example & Tutorial understanding programming in easy ways.

What is operator overloading?

Operator overloading is a function where different operators are applied and depends on the arguments. Operator,-,* can be used to pass through the function , and it has their own precedence to execute.


Example:

class complex {

double real, imag;

public:

complex(double r, double i) :

real(r), imag(i) {}

complex operator+(complex a, complex b);

complex operator*(complex a, complex b);

complex& operator=(complex a, complex b);

}

Read More →