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

Super() overrides

From the course: TypeScript: Object-Oriented Programming

Start my 1-month free trial

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…

Contents