Restrictions on Overloaded Operators
- The following C++ operators cannot be overloaded:
. .* :: ?:
- You cannot overload the preprocessing symbols # and ##.
- You cannot change the precedence, grouping, or number of
operands of the standard C++ operators.
- An overloaded operator (except for the function call
operator) cannot have default arguments or an ellipsis in
the argument list.
- You must declare the overloaded =, [], () and ->
operators as nonstatic member functions to ensure that
they receive lvalues as their first operands.
- The operators new and delete do not follow the general
rules described in this section.
- All operators except the = operator are inherited.
- Unless they are explicitly mentioned in Special Overloaded Operators,
overloaded unary and binary operators follow the rules
outlined in Overloading Unary
Operators and Overloading
Binary Operators.
Overloaded new and delete
Copy by Assignment