Inheritance and Polymorphism - Classes and Object Oriented Programming (OOP) - Javascript In Depth

preview_player
Показать описание
We learn about two of the four pillars of OOP: Inheritance and Polymorphism. We take a look at how these work specifically in Javascript together.

To start, we look back at why we need more than just Classes and how we can avoid duplicate code by creating a template and defining a "super" and "sub" class.

We take a detailed look at the "super" keyword and how it works to call the constructor in the parent class but also methods from the parent's prototype/class.

We wrap up by taking a look at Polymorphism and the power it has when combined with Inheritance. This also leads us to learning about the "instanceof" operator in Javascript.

Note that this is an advanced topic and will take a lot of practice and trying different things over time to really cement. We'll go through some practice exercises together on Inheritance and Polymorphism in the next video in the series.

Chapters:
00:00 Introduction
01:05 4 Pillars of OOP Recap
01:50 Fantasy Game Player and Enemy
03:00 A Warrior Class
04:18 Warrior and Wizard Classes
07:20 Warrior, Wizard and Bartender Classes
09:40 A Base Player Class (Super Class)
12:41 The Warrior Sub-Class
20:57 Super and Sub-Class Code Example
33:38 Inheriting Methods
35:35 Inheriting Methods Code Example
38:32 The "super" keyword
40:40 "super" keyword Code Example
45:53 "instanceof" keyword
50:29 Polymorphism
58:20 Polymorphism Code Example
1:05:09 Next Steps

Рекомендации по теме
Комментарии
Автор

Nader is to JavaScript as havard is to school
You're the best

nanlunglongtau
Автор

Inheritance n polymorphism.... Done!! ✨
Thanks Sir! You explain so well!

ujjwalranjanraoietlucknows
Автор

This is the best explanation on this topic on youtube.

pranay
Автор

You're javascript explanation/teaching make it easier to learn. Still waiting on your React course.

React_Media
Автор

I understood JS promises thanks to your exercises, now im getting better with OOP, thanks a lot man, it must be crazy difficult making these videos, I highly appreciate your dedication, last night I told my wife, if the day ever comes to quit my job and become a programmer it will be thanks to Nader, thanks, you are an amazing teacher

ilijajovanov
Автор

This is great video Nader very well explained thank you so much! I'm glad I found your channel.

hazelcaling
Автор

Love your videos dude! Keep up the good work <3

adrian_main
Автор

I'm glad that I discovered your channel. I like your definitions and telling style. Definitely looking forward to these concepts more! Keep it up!

zeckey
Автор

شرح رائع كالعادة نادر💚
💚Great explanation as usual Nader

muhammadragab
Автор

Love the clear explanations and the slides really help visualize the concepts to further grasp the whole picture. Thank you!

hanayuhyki
Автор

Hello Nader, many thanks for your extremely useful videos! They do help a lot! Can I ask what extension do you use for the VSCode that your text differentiate in colors as well as the text decoration? Thanks in advance!

AnnaKladovaBohun
Автор

Glad I found your channel Nader. On my way to become a Junior dev and these videos are super helpful, although watching your interview videos it kinda hits me an anxiety lol

Nulledx
Автор

Wow, just wow. You gained a subscriber

khulanimasikodlamini
Автор

Great expalanation, as the rest of the JS in Depth series - even when I still struggle with Recursion hahahaha

raulbonillaclaramunt
Автор

is it correct to say Polymorphism is possible through Inheritance?

AsakuraAvan
Автор

thank you so much for this, really helpful!

devoiddude