Operator overloading is one of the exciting features of C++. All the built-in operator can be applied to basic data types (int, float, char).
For example + operator could add two integers no. or two floats no.
C++ provides the provision with + could be used to add two user-defined data types such as objects. So operator + can add basic data types as well user-defined data types.
That’s how we can say operator + is overloaded.
Operator overloading means that the operators:
Have multiple definitions that are distinguished by the types of their parameters, and
When the operator is used, the C++ compiler uses the types of the operands to determine which definition should be used.
Have multiple definitions that are distinguished by the types of their parameters, and
When the operator is used, the C++ compiler uses the types of the operands to determine which definition should be used.
Tags:
Cpp