Level 2

Operator Overloading

views

8:22
Suppose you have created a class for the marks of students. The marks in the first exam have been stored in one object and the marks in the second exam have been stored in another object. Now you would like to add the marks in both the objects and store it in another object. If the feature of operator overloading was not available, then we would have had to take the marks for each subject individually and add them and store them. But using operator overloading we can write a function for the addition operator and do it easily.