Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: C++
Expertise: All
Sep 4, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Restrictions on Operator Overloading

The following restrictions apply to operator overloading:

1. Invention of new operators is not allowed. For example:

void operator @ (int) ; //illegal, @ is not a built-in operator or a type name
2. Neither the precedence nor the number of arguments of an operator may be altered. An overloaded && for example, must have exactly two arguments--just like the built-in && operator.

3. The following operators cannot be overloaded:

Direct member access operator 				. 
De-reference pointer to class member operator 		.*
Scope resolution operator				::
Conditional operator					?:
Sizeof operator						sizeof
Similarly, any of the new casting operators: static_cast<>, dynamic_cast<>, reinterpret_cast<> and const_cast<>, as well as the # and ## preprocessor tokens, may not be overloaded.
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date