Most can be overloaded. The only C operators that can’t be are .
and ?:
(and sizeof
, which is technically an operator). C++ adds a few of its own operators, most of which can be overloaded except ::
and .*
.
There is no fundamental reason to disallow the overloading of ?:
. So far the committee just hasn’t seen the need to introduce the special case of overloading a ternary operator. Note that a function overloading would not be able to guarantee that only one of expr2
and expr3
was executed.
sizeof
cannot be overloaded because built-in operations, such as incrementing a pointer into an array implicitly depends on it.
&,*,«,» can be overload so correct answer is
Answer: D