I have something like this…
void f(dclass b);
class dclass
{
dclass(string s);
};
f("s");
This does not seem to work. In principle, it could with double conversion: char* -> string -> dclass
So there is no such a thing in C++. Or maybe some compilers support it… Do you know a language where it may be possible?
It could, but this won’t really work in languages with overloading. You turn an O(N) overload resolution into an O(N*M) overload resolution. In general, overloading is considered a more valuable language feature than multiple user-defined conversions.