We'll come back in this video.
We're going to keep going with our quiz app, and we're going to add some parts of the quiz class so
that we can display a question on the screen.
So therefore let's go ahead and create a new class here which I'm going to call quiz dot CSS.
Now in this class what do we need.
Well we need to know the questions that we're going to display as well as the score that we're going
to collect.
But let's just start with the question.
So here this will be a question array of question.
And yeah we can call it questions.
That's a good name.
The idea here is that when we are using our constructor here.
So when we are creating a quiz option we want to get the questions passed to our quiz directly.
So here I'm going to say questions or question array is going to be questions.
And here we're going to pass this questions here into our questions array.
So that's the idea.
Now there is one thing that I wanted to show you.
And that is really important in this context.
And that is the this keyword okay.
The this keyword is very versatile.
It has many different use cases.
But in this particular use case it has one particular thing that it does, and that is that it says
that this is going to be in the questions of the entire instance instead of the questions of our constructor.
So what does that even mean?
Because if you look at it, you can see that this questions here is grayed out because this questions
is never used.
So it is grayed out because we never used it.
But we did use it here.
Well the thing is we used the same name for the questions parameter here.
As for the questions global private questions variables so to speak.
Right.
So for this field now our compiler doesn't know that this questions here.
This left one is supposed to be the one from the here from the top.
If I want to make sure that it does understand it I need to add this dot before the name.
So now you see if I click on it you see it says it's this questions here.
So it's not this parameter questions anymore.
You see here this parameter questions is now marked.
If I click on this this one is marked.
So you see they are connected to each other.
So what is this keyword does is basically saying you know what I want you to use the variable called
questions that belongs to the class quiz and not the one that belongs to the parameter that you're passing
to me.
Like this questions parameter.
So now what we're saying is, whatever you're passing to me as the argument to my quiz constructor.
So whenever you're creating a new quiz, the questions that you're going to give me, I'm going to store
inside of the questions that is this private field that I have up here.
Okay.
So now you've seen how to use the this keyword.
This is one of the applications.
There are many more applications for it.
But I'm just going to have it here like so.