Operator overloading is an important feature of C++ and it allows to attach an additional meaning to operators when used with user defined data types i.e. classes. When an operator is overloaded, it gains an additional meaning relative to the class in which it is used.
Operator overloading refers to the technique of giving normal c++ operators an additional meaning when they are applied to user defined data types/classes.
Using operator overloading complex program segments can be replaced by more natural looking statements.
(1) To concatenate two string we write the statement as
Using operator overloading the above statement can be written as
(2) To add two distance objects
Using operator overloading the above statements can be written as