nNotice that this conversion function has no return type.
That is because the return type is
implicitly specified (other_type),
since that is the type we are converting to.
nThe conversion function
converts the current object into the
new type and returns the value.
nThe name of the
conversion function must be a single identifier;
therefore, for types that are not a single identifier, a typedef must first be used. In the
class:
n typedef const char* pchar; //make single
identifier
n operator pchar(); //conversion (name to char*)
nImplementing:
nname::operator pchar()
{ //conversion function
n ...
n return array; //of type char * being returned
n}
n
n