While operators like + , - , *... can be overloaded, operators like ?:, ::, . cannot be overloaded. Why is this?
While operators like + , - , *... can be overloaded, operators like ?:, ::, . cannot be overloaded. Why is this?
:: works on namespaces and type names, you can't overload that because types aren't something you can return in C++.
?: could possibly be overloaded as long as you give up its short circuiting aspect, since you'd have to receive both branches as parameters. Not worth the drawback in my opinion.
. could definitely be overloaded, it has the same logic as -> (with slightly different binding, of course). The reason why it's not is anyone's guess however.