TypeScript 3 Fundamentals, v2 Classes
This course has been updated! We now recommend you take the TypeScript Fundamentals, v3 course.
Transcript from the "Classes" Lesson
[00:00:23] Which allow us to have control over who can see member data and member functions on instances. So let's go to the notes, to the 4-class-basic.ts file
>> Mike North: So in this example, you can see a couple things. The first is that we're using a new something I've been calling a heritage clause, right?
>> Mike North: What this means for any class that implements this interface, we have to make sure that these properties that conform to that interface are available and stated upfront. So, in terms of what this means up here, this is us declaring that these member data fields will exist. And their type is going to be a string.
[00:01:55] Here we're stating that we accept two parameters within our constructor, we accept two parameters. And down here, we are making sure that we pass the things our constructor receives onto the instance, which of course is this, within the constructor.