I know that we can’t overload operator with other meaning, we can’t create new operators, and we can’t overload without user-defined class. If I overload operators incorrectly? what errors will report? compiler errors or runtime error?
If I overload **, what would happen?
You can overload only existing operators. There is no
operator **in C++.If you try, the compiler would complain.
Operator overloads are checked at the compile time. If it compiles, it’s just a kind of function, so the possible runtime errors are the same as for any other function.