Skip to main content

#TC201 #Topic12 What is polymorphism?

1 min read

Polymorphism in a cientific way is when we use inhertiance to create new classes, each new class inherits both the data members and the methods of the superclass. But simethimes the methods need to behave differently depending on the new class deinition. In the case where the subclasses may need to behave differently, they still contain the same method name but they have a different implementation.

Well, in few words and well explained is when a subclass inherit a method from the superclass and another subclass inherits the same method and both of them do something related to the method but not the same thing each of them override the generic method that the superclass inherits to do what they need to do.

Source: Polymorphism