In the previous chapter, we learn the fundamentals of OOPS, i.e., the creation of user-defined data type classes and objects in Python. In this chapter, we will learn one of the significant features of object-oriented. programming structures (OOPS) that is operator overloading. As implied from the name, operator overloading means assigning special meaning to the existing operator to perform some intended task. In other words, the same operator exhibiting different meanings as per the situation is called operator overloading. For example, the “+’ operator is used to add two numbers, the same can be used for merging two lists and concatenating two strings. It indicates that the same ‘+’ operator can be used to perform different tasks based on the context in which it is being used.

Similarly, two-class objects can also be added by using the concept of operator overloading by using the similar syntax that is used for adding two integer numbers. In the following sections, the concept of operator overloading is discussed in detail.