Keep your code DRY and in sync by extending your parent class.
- [Instructor] Now, in our introduction to inheritance, … we had our graphics showcasing our Animal class. … And now from lines 2 to 12 here, … we have the very same things, except actually code. … What I'd like to do is go and build a derived class, … or our child class for Dog, and for Cat, … just to see how we would inherit from it … without having to repeat the properties. … So, we're going to create a Dog class first … because I have two dogs, I happen to like dogs, … and it's going to extend our Animal class. … At this point we've inherited three properties, … everything in Animal. … And if we went and created a new Dog here, … and we passed in the age, … my dog is about 2, he has 4 legs, … and his name is Gator, … 'cause I live in Florida I wanted to give a Floridian name. … Now, if we want to use those properties, … you can see here we have age available, … we have name available, we had legs available, … all the same properties that are in our Animal class. … And if we did the same thing, …
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.