Can we overload operators for built-in types like int or float?

c++, overloading

Solution

You cannot redefine a built-in operator. Operator overloading is designed to allow you to extend the language, not to change it. At least one of the parameters of an overloaded operator must be a user defined type (class or enum type) or a reference to a user defined type.

Problem

Can we declare a function like this in C++: ``` int operator + (int , int); ```

Original source

Related problems