Most of the websites,articles i have gone through explains operator overloading by giving the following standard example.
class Complex
{
int real;
int imaginary;
public Complex(int real, int imaginary)
{
this.real = real;
this.imaginary = imaginary;
}
public static Complex operator +(Complex com1, Complex com2)
{
return new Complex(com1.real + com2.real,
com1.imaginary + com2.imaginary);
}
public override string ToString()
{
return (String.Format("{0} + {1}i", real, imaginary));
}
}
}
We as beginners think ,operator overloading would be quite useful for scientific-application.
Will operator overloading be quite useful for e-commerce ,ebanking or other applications? As we saw standard example given above,it quite hard to grasp the real power of operator overloading.could you please explain it by providing example as necessary.