There are 5 operators which cannot be overloaded. They are:
* .* - class member access operator
* :: - scope resolution operator
* . - dot operator
* ?:: - conditional operator
* Sizeof() - operator Note:- This is possible only in C++.
Chat with our AI personalities
The following C++ operators cannot be overloaded...
No, java does not support explicit operator overloading. You can use an operator only for its intended purpose. But the "+" operator is implicitly overloaded. It can be used to add two numbers as well as concatenate two strings. Apart from this operator all other operators can be used only for their specific purpose.
it cannot be operator overloaded.
The prefix increment operator is overloaded as operator++() while the postfix increment operator is overloaded as operator++(int).
The only "special" operators in C++ are those that cannot be overloaded. That is; the dot member operator (.), pointer to member operator (.*), ternary conditional operator (:?), scope resolution operator (::), sizeof() and typeof().
The ternary operator (known as the conditional operator in C++) cannot be overloaded because it is impossible to pass a test operand and two expression operands (either or both of which may be comma-separated) to a function. You can only pass values or references as arguments to a function. Even if it were possible, built-in functions and operators that rely on the conditional operator would likely break. Like all the other operators that cannot be overloaded (sizeof, typeid, ::, . and .*) the results must always be predictable because built-in operators and functions rely on them so heavily.
Yes. Any function can be overloaded. However you cannot override a static member function. Only instance members can be overridden.