what is the defination of operator overloading and why should we use it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the defination of operator overloading and why should we use it?

some examples will be nice

12th Jun 2020, 7:49 AM
Zihan Sabah
Zihan Sabah - avatar
1 Answer
+ 2
There is no should about it. As Java demonstrates, you can never use it and still write any program you want. However, it can make the program easier to understand if used correctly. Without: Data value = first.plus(second.times(third)); With: Data value = first+second*third;
12th Jun 2020, 7:35 PM
John Wells
John Wells - avatar