Operator Overloading: A Brief Overview
An overloaded operator is a programmer-defined function that has a special name (composed of the keyword operator and the operator symbol or symbols). Overloaded operators are also known by the names of operator functions, overloaded operator function, or just operators. They provide the convenience of operator syntax for manipulating objects of programmer-defined classes.
The driving force behind the incorporation of overloaded operators into C++ is the desire to treat objects of programmer-defined types in the same way as variables of built-in types are treated. If you can add two numeric values, there is no good reason why you cannot add two Account objects. If you can add three numeric values, you should ...
Get Core C++ A Software Engineering Approach now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.