Can we declare a function like this in c++:
int operator + (int , int);
Your answers will be appreciated!
Thanks
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.
Yes: You can pass ints and floats into overloaded functions
No: You cannot overload/override the operators for built in types when the built-in types are on both sides of the expression.
No we cannot overload integer or float types because overloading means to change the working of existing operators or make them to work with objects int is single member not an object.