Wednesday 22 February 2012

What is a conversion operator? | Constructor in C++

 A conversion operator converts an object of a class in which you define the function to an object of a different data type. A conversion operator uses the C++ operator keyword in its declaration. C++ uses public as an access specifier, which can be used in a class as a public method for specific data type conversions.
Program:
In the preceding code snippet, operator double has no function assigned for the modification of the object/so it is better to make it constant.