Conversion Constructor:
Constructor with a single argument makes that constructor as conversion ctor and it can be used for type conversion.
For example:
class Boo
{
public: Boo( int i );
};
Boo BooObject = 10 ; // assigning int 10 Boo object
Conversion operator:
Class can have a public method for specific data type conversions.
For example:
class Boo
{
double value;
public:
Boo(int i )
operator double()
{
return value;
}
};
Boo BooObject;
double i = BooObject;
// assigning object to variable i of type double.
now conversion operator gets called to assign the value.