From the course: TypeScript: Object-Oriented Programming
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Super() overrides
From the course: TypeScript: Object-Oriented Programming
Super() overrides
- [Instructor] You may have been wondering earlier if the super keyword that we use to pass the data from our child constructor to our parent constructor is just one and done, and we're not ever going to really reference it again. But we are. And it's one of the items that distinguishes extends from implements more than anything else. You see here in our cat class on line 19, we have our meow method. Let's go ahead and actually just add a copy of this to our parent class like so, and we'll just do a generic one instead of meow hiss hiss, we'll do roar, roar, roar, something a little bit more generic. The meow name may not be that generic, but that's not what this is about right now. What we've essentially done is we have overwritten our animals meow with our cat meow. Now the super keyword here actually allows us to access methods from our parent class. Now, when overwriting methods, there's always a reference to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Inheritance introduction1m 54s
-
(Locked)
Extending classes in TypeScript2m 40s
-
(Locked)
Implementing classes in TypeScript1m 22s
-
(Locked)
Super()3m 43s
-
(Locked)
Super() overrides1m 56s
-
(Locked)
Generics2m 46s
-
(Locked)
Polymorphism3m 8s
-
(Locked)
Challenge: Inheritance59s
-
(Locked)
Solution: Inheritance3m 10s
-
-
-