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

What is operator overloading& where it is use?

23rd Aug 2018, 5:06 AM
Samrat✌✌
Samrat✌✌ - avatar
5 Answers
+ 2
Samrat✌️✌️ The concept is the same Operators are functions that come with the library a+b can be rewritten as sum(a, b) So by overloading the 'function' you make it take objects instead of values as arguments then write a different implementation for the function know what I'm sayin?
23rd Aug 2018, 11:22 AM
Moses Odhiambo
Moses Odhiambo - avatar
+ 1
This is defining custom use for operators on objects. Something like that. I mean who cares about the definition, just know how to apply it.
23rd Aug 2018, 5:53 AM
Moses Odhiambo
Moses Odhiambo - avatar
+ 1
Operator overloading allows programmer to redefine the meaning of an operator. So, an overloaded declaration is a declaration that is declared with the same name as a previously declared declaration in the same scope, except that both declarations have different arguments and obviously different implementation. And when you call an overloaded function or operator, the compiler determines the most appropriate definition to use, by comparing the argument types you have used to call the function or operator with the parameter types specified in the definitions.
23rd Aug 2018, 8:05 AM
Iomi_Tashia
Iomi_Tashia - avatar
+ 1
Yana Titovec that is known as function overloadig 😂😂😂😂😂
23rd Aug 2018, 11:19 AM
Samrat✌✌
Samrat✌✌ - avatar
+ 1
Moses Odhiambo i dont want defination i only want to understand the concept
23rd Aug 2018, 11:22 AM
Samrat✌✌
Samrat✌✌ - avatar