Python Programming - Polymorphism - Discussion

Discussion Forum : Polymorphism - General Questions (Q.No. 20)
20.
Which of the following is an example of polymorphism through operator overloading?
Using the + operator to concatenate strings
Using the + operator to add two numbers
Using the + operator to access a list element
Using the + operator to define a custom behavior in a class
Answer: Option
Explanation:
Polymorphism through operator overloading in Python involves defining custom behavior for operators in a class, such as using __add__() for the + operator.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.