Join Dylan Israel for an in-depth discussion in this video Solution: Inheritance, part of TypeScript: Object-Oriented Programming.
(upbeat music) … - [Instructor] So I'm going to go ahead … and actually close this User class … just 'cause it takes up quite a bit of the screen … and we'll start with our Admin class here. … Now, our Admin class is going to extend User. … Now, as in step four, … we said hey, we want a constructor … and notice at the get go, … we have this error, right? … That's because when we have a derived class … or a child class, … we want to call super here. … Now, there's no constructor … in our User class, so we don't need … to pass any values to it. … If we do, we would. … In our case, all we're going to do here … is paste in a firstName: string, … a lastName: string … and an email that is a string … to pass our values to it. … Now, once thing is we'll go and reset these values … so that when we construct our admin, … we have the ability to. … You'll notice, when I move this to above super … that we get this error that's basically saying hey, … super always has to come first. … So just keep that in mind. …
Skill Level Intermediate
TypeScript: Upgrades and Featureswith Emmanuel Henri1h 15m Advanced
TypeScript for Node.js Developerswith Emmanuel Henri1h 2m Intermediate
1. Classes in TypeScript
2. Inheritance in TypeScript
3. Access Modifiers in TypeScript
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.