Is it possible to type cast basic data type to class type by overloading conversion operator or do I have to overload = operator in c++
just to be clear
classname obj; float f=obj; is overloading typecasting operator from class to float and
float f; classname obj=f; is typecasting from float to class.So my question basically is for latter code to be correct is it possible by overloading typecasting or should I use overloading = operator.
I know overloading = works but I just wanted to know if it's possible to overload typecasting operator in that way.
static_cast<float>(obj)or(classname) f.