
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How will you explain Python Operator Overloading?
Every class in Python, whether built-in or user defined is inherited from object class. The object class has a number of properties whose name is preceded and followed by double underscores (__). Each of these properties is a wrapper around a method of same name. Such methods are called special or magic methods.
The magic methods __lt__(), __gt__(), __eq__(), __ne__(), etc. are overridden in a class to overload <, > == and != operators respectively.
- Related Questions & Answers
- How will you explain Python namespaces in easy way?
- How will you explain Python for-loop to list comprehension?
- How will you explain that an exception is an object in Python?
- How can we do Python operator overloading with multiple operands?
- Overloading unary operator in C++?
- How to use Operator Overloading in C#?
- How to implement operator overloading in C#?
- How will you compare namespaces in Python and C++?
- How you will create your first program in Python?
- How will you handle alerts in Selenium with python?
- Rules for operator overloading in C++
- Overloading array index operator [] in C++
- How will you compare modules, classes and namespaces in Python?
- Explain function of % operator in Python.
- Increment ++ and Decrement -- Operator Overloading in C++
Advertisements