In all of us examplar we saw how to make the basic class and objects out of it we can make this a little
bit simpler.
We just firstly erase everything the sites Lessie anti-big and or class we can build something called
a constructor.
So in our case we always want a pet have a name and an age so we can make it mandatory said you have
to use the name and the age if you want to make an object for class.
So all of us if you want to make an object you have then to use that to give it a name and an age and
that's made with a so-called constructor.
And this works like this if you want to make a constructor in the juat class with say a pet so that
exact same name as are classier.
And then we say string name and in h.
So we use the exact same thing as here because we want to make it mandatory to use name and age and
then we say this name.
This is a key word with with this we
we like
call like this class if you say this You mean like this class in which you are in the moment.
So this references this class.
And with this name you can you can call your overboots up here.
So if you say this name you mean this Fariba up here and then you say this name will its name and this
name is this name up here and six Sing-Sing is this h h blitz h.
So again with this you reference your class and age is this variable.
Right.
So the variable of your class H.
So this one here and this should equal you or construct a variable.
You made it up here.
And this basically says if you feel constructor get caught you have to give it a name and an H and this
name and age should get saved in this verb and this verb.
And we see we go to an arrow up here because we got to quiet arguments.
These are two arguments we have to set and we said no hit
let's see comma and three and then can you raise ever sing on the knees at.
So basically says now on your pitch.
This is all constructed.
And we've made our construct.
Don't have fallen.
We had a construct that any meetings and now we've made construct with two parameters and one that always
said the name and the age.
That's what we did here.
So we always want to get the name and the age if one to the an object.
And if calling can construct up here we give it the name and the age and they get set to this variable
and this variable so we can make an object of class with the name and the age and we don't have to call
it like we did before.
With Let's see point name Lessie pond H.
And this is a long way to make a construct.
We also have a short way.
Basically it is hat and then have this name.
And then this H.
Coalmines this all to go in this art and this is exactly the same.
And in the background happens what we just typed.
Yes so with this name you reference this verb IPA and say h.
You reference this h right here.
So if you if you make new object by calling our constructor here you give it your name and the name
gets set to this verb.
And that c h gets set to this verb.
So if you want to call one or a few words now you can just simply say print the name and copy it.
And print the C H and run it and to get exactly Lessie and Srey because you said it here and here you
it gets set to your variables and you can access their boats with name or few or Fariba object there
but and then the name and the H.