I would like to convert object to double value.
It looks following ->
ClassA clsA(1,2,3);
double result = clsA;
I wrote sth like that in my header file:
const double operator= (const ClassA&);
And implemented in cpp file:
const double ClassA::operator= (const ClassA& a) {
/* here I made some math calculation on instance 'a' and the result is double value *\
return doubleValue;
}
But It won't work, I don't know if it's good idea to make it, also I use operator = to assign one object to another example -> objA = objB, so I don't know if it can argue together with above implementation.
Thanks for help!