In the context of operator overloading, what is the difference between user-defined conversion and user-defined operator?
A user-defined conversion is either:
or
operator DESTTYPE()As you can see, the second option uses the operator keyword just as is used when overloading the traditional operators.
(Note: All of this is formally described in section [class.conv] of the C++ standard.)
In C++, there is no concept of user-defined operators that can be overloadable. Only existing operators, with an exception of few( ., .*, ::, ?:, sizeof ), can be overloaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With