I have a function like below:
void add(int&,float&,float&);
and when I call:
add(1,30,30)
it does not compile.
add(1,30.0,30.0) also does not compile.
It seems that in both cases, it gets implicitly converted to double instead of float.
So, do you suggest that it is better to re-define add as add(int&,double&,double&)? Is there any other way of passing making add(1,30,30) work other than casting 30 with float or assigning like "float x = 30 ; add(1,x,x)" ?
I used to think that the compiler will be able to detect that float is a super-set of integer and so would compile it successfully. Apparently, that is not the case.
Thanks!