TypeScript Basics 14 - Inheritance and Polymorphism In TypeScript
HTML-код
- Опубликовано: 3 дек 2024
- Access the full course here: javabrains.io/...
In this lesson, we'll learn how inheritance and polymorphism work in TypeScript. Create multiple classes that extend the same base class and use polymorphism to access those instances.
Course: TypeScript Basics
Learn about the basics of TypeScript. Understand how types work, how to use arrays and tuples, how to declare classes and interfaces. Understand concepts of type erasure, duck typing, enums, generics and modules. Create a development workflow and configure the TypeScript compiler to your needs. And watch as I build an end-to-end TypeScript application from scratch.
So much similarity with Java, such a relief.
ikrrr
Hi Koushik,
Thanks for all the great courses. I feel much confident after going through your tutorials. I have a query w.r.t. this tutorial and would really appreciate your response. I did inheritance in typescript as in this video and then went on to check the corresponding transpiled JS code for that. I found to my surprise that the inheritance done in JS code is much different than what I understood from your JavaScript inheritance tutorial where childClass.prototype.__proto__ = parentClass.prototype was sufficient to create inheritance chain. I would be extremely grateful to you if you help us with a connect between the two logic. Always a great admirer of you :)
Best,
Rahul
Hi Koushik, ty , your videos so helpful
How nice to find the same concepts here as in Java
Such amazing content!! Thanks so much!!
In the polymorphism example, are we typecasting aProgrammer object to be of type Person instead of Programmer ?
GOOD JOB!!!!
in C# or any c language if base class is holding instance of derived class, when we make a call for same method name it would execute from base class method. i think its different in typescript
Same doubt... Parent class method should be called. Instead child class.
Great TypeScript videos. Thank you for your impressive efforts. If you don't mind a question, what are your settings.json for ("terminal.integrated.shell.windows":) ?
JavaScript also has class data sturcture
Correct, since 2015. It made a huge difference for JS.
"Programmers are people after all"
You're not fooling anyone bro
Hello World! Koushik.
1:25 When you side programmers are people after all. 😅😅
you have to use a constructor always
Don’t use var, use let or const :)
There IS inheritance in javascript, and way more elegant than typescript or other OOP type inheritance. it is so simple that people think it is wrong to use it. Why? The funny thing is people think that TS is a strongly typed language, thus more reliable than loosely typed JS. They forget that every typescript at the end must be transpiled into javascript, which simply ignores types. Funny how programmers love to make their life harder.