Operator overloading | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Operator overloading

I can't understand operator overloading in c++.can anyone explain or give me some resources to learn??

16th Nov 2018, 4:39 PM
1704086_ibnul
1704086_ibnul - avatar
11 Answers
+ 7
This is where I got my syntax from: https://en.cppreference.com/w/cpp/language/operators They are my first search for anything C++ as most things in the language these days weren't there when I learned it. Since my C++ was for embedded systems, we didn't use a lot of the features added after that. Other places that might be fine: https://www.geeksforgeeks.org/operator-overloading-c/ https://www.programiz.com/cpp-programming/operator-overloading
16th Nov 2018, 6:03 PM
John Wells
John Wells - avatar
+ 8
No, I retired in 2016.
16th Nov 2018, 7:20 PM
John Wells
John Wells - avatar
+ 7
I started with C in 1975. C with classes in 1980 (coworker was student of Bjarne Stroustrup.) This became renamed as C++ in 1983.
16th Nov 2018, 6:21 PM
John Wells
John Wells - avatar
+ 6
Do you have any code you are trying to make work as this is way too big of a topic to answer in a post. I've got a sample here: https://code.sololearn.com/cStdw0OPtPxG If you ask about a line or two at a time, I should be able to help you.
16th Nov 2018, 5:16 PM
John Wells
John Wells - avatar
+ 5
I learned Fortran and Cobol in 1973, having a job programming for my college.
16th Nov 2018, 6:52 PM
John Wells
John Wells - avatar
+ 4
John Wells I now have a sense of what the younger members here might think when I tell them I've been professionally programming since 1996, which was near or before when many here were born. You've been doing this since the year I was born. 👶 You, sir, truly are a legendary O.G. 👑 😎
16th Nov 2018, 6:49 PM
David Carroll
David Carroll - avatar
+ 2
Nice! Are you still professionally active today? If so, what are you doing these days?
16th Nov 2018, 7:15 PM
David Carroll
David Carroll - avatar
+ 1
You probably know that strings and ints behave differently when you add them: "1" + "1" - > 11 1 + 1 - > 2 By operator overload you can define for your own types, what should happen when you use an operator like for example +.
16th Nov 2018, 5:12 PM
HonFu
HonFu - avatar
+ 1
John Wells How long have you been programming programming in C++???
16th Nov 2018, 6:13 PM
Mensch
Mensch - avatar
+ 1
John Wells thank you,sir😊
17th Nov 2018, 9:44 AM
1704086_ibnul
1704086_ibnul - avatar
0
John Wells i know this is a large topic and i have so many questions,so can you plz refer me any good resources where i can understand the concept better??
16th Nov 2018, 5:55 PM
1704086_ibnul
1704086_ibnul - avatar