I'm trying to convert a object to a float, but it doesn't seems to work the way I want.
int main()
{
Fraction A(20,6);
float E;
E = A;
cout << E << endl;
}
I already did a type convert operator inside the class
operator float () const
{
return static_cast<float>(num/den); //Being num and den private members, 20 and 6 in this case.
}
When I run the program, the result is 3 (with no decimal places). Any help?