How to create conversion functions in C++?

In C++ you can create conversion functions to convert one type class to another. It is a simple type conversion and there are no parameters involved. The conversion function you create should be a member of that particular class. A conversion function can be virtual and can be inherited.

Syntax to create a conversion function:

operator type( ) { return value; }

Leave a Reply