How can one Overload Operators << and >> ? | SoloLearn: Learn to code for FREE!

+7

How can one Overload Operators << and >> ?

12/3/2016 2:46:21 AM

Dev 799

2 Answers

New Answer

0

Here is a simple example of turning a bitwise << into a + operator. https://code.sololearn.com/c4j07QdkvFLA/#cpp From "More On Classes, Operator Overloading", "Operators that can't be overloaded include :: | .* | . | ?: "

-1

This operators are said to be bitwise operators and are listed among the many which cannot be overloaded. So, the language does not permit to overload this operators, doing which would result into an 'Compiler' error. The other operators which cannot be overloaded are ' . ' , ' : ? ' , etc. Please do hit 'like', if you find the answer helpful!