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: Intermediate
Mar 3, 1998



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

Operator overloading rules of thumb

When overloading an operator to support a user-defined type (object), it is best to adhere to the basic semantics of that built-in operator. For instance, the built-in operator ==, which does not modify any of its operands, should also be overloaded in such a way that it does not modify any of its operands (and should be declared as a const member function, as a matter of fact). On the other hand, operators such as + =, which do modify their left operand, should be overloaded in a way that reflects that, i.e., by changing their objects. Note that in many cases, the implementer
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