Home »

What is conversion operator?

Question ListCategory: cWhat is conversion operator?
ethanbrown author asked 2 years ago
1 Answers
adamemliy16 author answered 2 years ago

class can have a public method for specific data type conversions.
for example:

class Boo


double value;


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.

Please login or Register to Submit Answer