So as we reach the end of this section,
let's quickly review all the terminology around classes
because there is so much different stuff going on.
So a lot of different features that you can use.
And since classes are probably the way
you're gonna implement OOP by yourself,
it's always good to have a nice overview of everything
that we can do with them.
So here we have a huge class,
which essentially contains all the features
that we studied over the last couple of lectures.
So this is how we define a class.
And in this case, it is actually a child class.
So student is a child class of the parent class person
and that is because here we are using the extends keyboard
to set up the inheritance between these two classes.
And remember that the extends keyword
will also automatically set up the prototype chain for us.
So we don't have to do anything manually.
Next up, this is how we define a public field.
So this is what we did in a very recent lecture.
And so remember that a public field is very similar
to just a property that we defined in a constructor.
So it is available on every created object.
So on every instance created by this class.
Then of course, we also have private fields
and they are almost the same as public fields,
but they are not accessible outside of the class.
And so therefore this is perfect
for implementing data privacy and encapsulation.
We also have static public fields.
And so these are fields or like properties
that are available only on the class.
And I didn't show them to you in the code.
So in one of the lectures,
but this is how we can implement them.
So just like static methods,
we use the static keyword to make any field static as well.
Then here, this is the constructor method
and it is automatically called by the new operator
whenever we create a new instance of the class.
So basically a new object.
And this constructor method is mandatory
in any regular class, but it might be omitted
in a child class if we want it to have the exact same number
and the exact same name of parameters.
Then inside of the constructor there is the call
to the parent class and so that is the superclass.
And this of course is only necessary
whenever we are writing a child class.
So when we're using the extent keyword.
And remember that this one needs to happen
before we access the disc keyword in the constructor.
Then here we have an instance property.
And so just like public fields,
the property is also available on each created object.
But the difference between this one and the public field
is that we set these instance properties
based on input data of the constructor.
So basically these properties are more personalized
and unique for each object while the fields are usually
for something that is common to all the objects.
For example, here at the university for all of the students
is the University of Lisbon.
And so that is not unique to each object, okay.
Then here we are redefining a private field.
And so this is what we did with the pin
in the bank account example, right?
So this private field should be unique for each student.
And so we created the private fields out there
without any value.
And then here we are simply redefining it to the value
that is coming into the constructor.
Then here, as we already know, is a normal public method.
Here, we are referencing a private field
and also a private method.
And so about the private methods,
this is how they look like.
But as I mentioned,
they will probably not yet work in your browser.
At least if you're watching this close
to the recording date of this course.
So as an alternative, you can fake private methods
by using the underscore convention instead of the hash.
Next up, this is what a getter method looks like.
And remember that a getter method is basically
so that we can get a value out of an object
by simply writing a property instead of writing a method.
So in this case, we could simply write student.testscore
and that would then run this getter method
and the same for the setter method.
So in this case, we can simply define the test score
by setting it to some value
instead of calling a test score method.
And keep in mind that if you have a setter
for a property that is already defined in the constructor,
then you need to create basically a new property
with the underscore in front of it.
So again, that is kind of a convention
that you should use in this case.
And then in the getter with the same name,
you also need to then return that new property.
So we did that in one of the lectures,
when we did a name validation for the name
that was passed into the constructor.
Remember that?
Next, this is how your write static methods
and a static method is available only on the class.
So it cannot access the instance properties nor the methods,
but only the static ones.
So for example, that static public fields
that we defined there in the top
will of course be accessible in the static method.
And usually we use these static methods
as helper methods for the class.
Finally, this is how you then create a new object
using the new operator.
And so this should be nothing new at this point for you.
Now, here's just a couple of things
that we need to remember about classes
and that I actually already mentioned before as well.
So keep in mind that classes are really just
syntactic sugar over constructor functions.
Also classes are not hoisted, they are first class citizens
and the class body is always executed in strict mode.
Okay, and there you'll have it.
This is an overview and also a summary
of the entire syntax of classes in JavaScript.