What is unary operator overloading? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is unary operator overloading?

23rd Jun 2018, 6:06 AM
jose kamau
4 Answers
+ 5
sammy what do you want to know?
2nd Jul 2018, 4:47 PM
John Wells
John Wells - avatar
+ 4
unary operators are ! + - for most languages such as !true, +5, -4. Operator overloading allows you to make operators have a method of your class. I have a full set of operator overloading examples for each language that runs here and supports it. Since your taking C++ to the point you might understand it, I'll link my version. The comments will get you to all the others. https://code.sololearn.com/cStdw0OPtPxG
23rd Jun 2018, 12:25 PM
John Wells
John Wells - avatar
+ 3
Line 28 declares my unary + operator, lines 118 to 121 gives it's implementation, and line 200 makes use of it.
23rd Jun 2018, 12:29 PM
John Wells
John Wells - avatar
+ 1
wanna know??
2nd Jul 2018, 4:35 PM
sammy