Slide 10
Slide 10 text
Javier Gonzalez-Sanchez | CSE240 | Spring 2020 | 10
jgs
Operator Overloading in C++
Like function overloading, C++ allows user to define operator (built-in function)
overloading.
Why do we need operator overloading?
• string1 = string2; instead of using strcpy(string1, string2);
• string1 >= string2; instead of using strcmp(string1, string2);
• rectangleArea(3, 5) < rectangleArea(2, 6)
• time1(3, 23) + time2(5, 56), resulting in: time3(9, 19)
• Increament a Date(year, month, day) object, what is the next date?