Is it possible to define a casting operator from one type to another type outside the class definition as a function that is not a member? I know that this is possible for other operators, such as an operator, but this is not possible with translation operators. For example, for two classes A and B, I tried to define a casting operator outside areas A and B as follows:
operator A(const B& b)
{
A a(....);
return a;
}
source
share