hi, how to overload operators in C++?Normally, following lines are not allowed:
double d = 5;
d = d^2;
//i wanna d to be 25;
How do I overload the operator ^ myself, to allow d=d^2?
Thanks!
-->
double operator ^ (double d)
{
return d*d;
}
{
return d*d;
}