The class keyword so you can replace the struct keyword within the class keyword.
So which declares members private by default.
So aside from default access controls.
Classes declared with the struct and class keywords are the same.
So for example, you could declare my date and time just the class here.
As you can see here, we just need to arrange these methods here.
So then here, as you can see here, let's make this like that and here and we will make this functions
public.
And as you can see here, we can run our code without any problem here.
So which way you declare class is a matter of style.
So there's absolutely no difference between between struct and class aside from the access controls.
So there are they are almost same and they are.
They are like, absolutely insane.
But they have like different they are different thing differentiating on access controls.
So I prefer using struct sometimes, sometimes class.
So and you may like use struct because having the public members listed first.
So but you will see all kinds of conventions out in the programming life.
So cultivate a style and stick to it.
So now I want to.
Having encapsulated the we have encapsulated here.
As you can see here, we have get.
Here and add here.
So you must now use methods to interact with this.
The my date and time.
So here I want to.
Seth for something here, so.
Let's delete this code and create new.
Here my date and time and clock.
Here.
If here not.
Operator.
Ternary operator.
Clock dot set here.
2018.
Here and clock that set here.
Dozen 19.
And then I will explain all of these codes here, clock that are here, here, and print f here.
Here is the.
And clock that get here.
Let's run.
Let's run our code.
As you can see, we got the output of to 2020 here.
So firstly, we declare the clock here and attempt to set its year to 2018.
So.
This file fails because 2018 is less than 2019.
As you can see here, we will we will.
As you remember in previous lectures, we will return false from if our set year value parameter had
less than 2019.
So in this case this statement the here returned true because we have the ternary operator here.
So if you have this operator, we just change true to false.
If it's false to true.
So and then you increment here, as you can see here, you increment a clock that add a year by one
with this function and.
Now you increment it once and you get the get here and here.
This output of it here.