JavaScript Classes #5: Polymorphism - JavaScript OOP Tutorial

preview_player
Показать описание
Polymorphism is the act of overriding methods within a derived class. Suppose you have a class called "CA" with a method "MA" on it - if you were to now create a child class of "CA" and then re-define the method "MA" on it, this would be polymorphism.

It is a commonly used technique when dealing with derived classes as in a lot of cases, the child class will be performing the same actions as its parent, but with a little extra.

In this video I take you through a simple example of polymorphism using the typical "Animal" class. I also demonstrate how you can call the parent-defined method through the use of "super".

For your reference, check this out:

Support me on Patreon:

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

One tip: you don't need to declare the constructor in the subclass if you're not adding anything additional. It will work the same! Thanks for the video.

govindrai
Автор

Finally a video that's not 2 hours long!

Pyraptor
Автор

i've came to watch this video and i ended up in watching 6-7 video and finally subscribed <3

jacksonjegatheesan
Автор

Thank you, so simple yet informative.

Videosuser
Автор

i really really appreciate you for this, i was struggling with Polymorphism for months, this video helped me alot

ericellison
Автор

Hey Dom, I really couldn't understand anything about classes before watching your videos, thanks a lot :))

francoise
Автор

Very helpful in learning oop. Thanks DOM you rock!

salmanali-yntw
Автор

This is the easiest and fastest explanation ever!!! 🤓

joelmuriuki
Автор

Great video! Kept it simple, and easy to understand. Thanks!

travisvirgil
Автор

thank you so much man, your awesome
you solved my problem by this video !
thanks a lot ♥

sinapsd
Автор

Thanks a lot ! I knew polymorphism in Java and C++ but not in Javascript.


Suggestion of next videos : design patterns, you're the guy we all need...I saw your Observer pattern video, really well explained ! Where are the other patterns ? :-) Abstract Factory, Factory Methods, etc..

gloubiboulgazeblob
Автор

a little question actually, you mean function overriding is polymorphism? isn't it having multiple definitions of a function for the different type of params, just like in OO langs ?

nuttygeek