coderz.py

Keep Coding Keep Cheering!

Operator Overloading in Python

Operator overloading refers to providing meaning that extends beyond their predefined operational meaning. For example, the operator + can be used to add two integers, join two strings, or merge two lists. It is possible because the ‘+’ operator is overloaded by the int and str classes. Therefore, the different behavior of a single operator […]

December 18, 2022 | python | No comments

Examples of Operator Overloading in C++

Let’s see examples of operator overloading in C++ for various types of operators. Examples: 1) Add given timestamps by overloading + operator setTime() function is used to set HR, MIN and SEC values. showTime() function displays the time in a specific format (HH:MM:SS). We add the seconds, minutes, and hours separately to get the new time […]

October 30, 2022 | C++ | No comments

Operator Overloading in C++

What is Operator Overloading? Operator overloading is a compile-time polymorphism in which the operator is overloaded to provide the user-defined data type with a special meaning. Most of the operators available in C++ are overloaded or redefined using operator overloading. It’s used to run an operation on a user-defined data type. Operators that can be […]

October 29, 2022 | C++ | No comments

Advertisement