Okay, so now that you've seen how to use the this keyword, let's keep going with the question displaying
feature.
Then we will need a method that will display the question okay.
So private void display question.
And it will need to know which question it's supposed to display okay.
So this method will allow us to display a question.
And what I'm going to say is I'm just going to use console dot write line question dot two string and
actually not question dot to string as the IDE gave me.
But I want to display the question text because if we look at our question, we have the string called
question text.
And it is a public property so we can access it.
So what we want is we want to display the question text here okay.
So that's what we're going to do.
Now unfortunately our display question currently is private.
So I cannot use it inside of our program.cs file.
I'm going to make it public however for a second for a quick second so that we can test it.
Okay.
So what I want to do is I want to test it inside of my main class.
So our main method.
So I'm going to have console dot read line so that my program stays open.
And I'm going to create a quiz which will be my quiz which will be a new quiz.
And now if you see well if we are using a quiz, you see we need to pass questions in it into it.
So that's what we defined here.
We said when you want to use the quiz give me questions.
So now let's go ahead and set up a few questions.
Or actually we can just start with one question.
So I'm going to create a question array which I'm going to call questions.
And I'm just going to say is equal to new question.
And I'm going to not define it in here how many it is, but I'm going to define it inside of the curly
brackets here.
So I'm going to say that I want to have a new question which will hold the following information.
So it will hold the question text the answer as well as the correct answer index.
So let's say I have the first question which is what is the capital of Germany.
And then I'm going to create a array of answers.
So here we could give like there are multiple different ways how we could have done it.
But I'm just going to put it directly in here where I'm going to say new string of, well, an array
of strings where I have four answers.
So one is going to be Paris, the other one is going to be Berlin.
Then we have London and let's use Madrid.
So we have Madrid here.
And then we need to say what the correct answer index is going to be.
And I'm going to say it is one.
So now I can use these questions and I can pass them in here to the quiz.
So let's hover over what's going on here once again real quick okay.
Because there's a lot going on here okay.
So let me show you step by step what this is.
So we are using the new keyword to allocate some space in the heap.
So in our memory so to speak for a new question array.
So then we're saying the questions that we're going to have are going to be inside of these curly brackets.
Then we're starting with one new question.
So I could obviously have more.
And I will add more questions later on.
But for now I just wanted to add one question so that we can test our application.
And I have this new question.
So here I'm creating a new entry of a question object.
And we have not seen that before because whenever we used arrays so far we just used default data types.
Right.
Like the base data types such as string, int, bool and so forth.
But this time we're actually using a data type of a class that we created ourselves.
So of a question class.
So now this question whenever we're creating a new question needs to have some information.
It needs to get these details here.
So we need to pass the arguments which are the question itself the question text the answers as a string
array if you look at it.
So here in question the answers as a string array.
So an array of strings and the correct answer index.
So which of those is the correct answer.
So what we're doing here is we're we're passing the question.
So this is the question text.
We're passing the answer options.
So answers array.
And we're passing the correct answer index.
So we're saying the correct answer is Berlin because the question is what is the capital of Germany.
Maybe we should add a question mark here.
And suddenly we.
Have our first entry of questions.
So then let's go ahead and actually use my quiz to display the first question.
Now let's look at our question once again or our quiz here.
So it needs to know which question it's supposed to display.
So what I'm going to say is you know what just display the first question.
So questions at index zero okay.
So for now I'm going to keep it really really simple.
I just want to display anything we're going to see later on how to get it better.
But this is like the first question that we see here.
It says what is the capital of Germany.
Now obviously we will need to modify our code quite a bit because this is just to build the app up step
by step and still run something without me showing you 100 lines of code, or typing out 100 lines of
code without showing you anything.
So this was step number one.
Now in the next step, we are going to modify our application to do it in the correct way.
Okay.
So see you in the next video.