What is polymorphism in object-oriented programming?

Questions & AnswersCategory: PythonWhat is polymorphism in object-oriented programming?
Lokesh Kumar Staff asked 2 years ago

What is polymorphism in object-oriented programming?
a. Polymorphism allows you to create a hierarchy of objects.
b. Polymorphism hides the implementation from the user of the class. An example of use is declaring variables as private. We don’t want to give access to these variables externally. We want to have hermetically sealed objects that will not be damaged by accident.
c. Thanks to polymorphism, we are interested in what is to be done, not how. How something will be executed will only be determined during the execution of the code.

1 Answers
Lokesh Kumar Staff answered 2 years ago

b. Polymorphism hides the implementation from the user of the class. An example of use is declaring variables as private. We don’t want to give access to these variables externally. We want to have hermetically sealed objects that will not be damaged by accident.