So I come again in business and you're going to talk about structures what this structure is is actually
very very similar to a class.
And if you already know how to use classes you can tell yourself that you already know how to use a
struct as well.
So just going to ex-coach and see how you're going to do that.
I'm going with ex-school.
I'm going to start a new command line to our swift language and I'm going to call it a struct.
It's said so in here I'm going to go ahead in my mane and say do this.
I have a struct or nothing that struct call the user.
And then it has this variable name which happens to be a string and a value of value ID which again
happens to be a string.
It feels very very familiar.
Right.
It's just like a class.
I would also have an initializer in name which is a string.
I could have him you ID which is this string and I would say self-taught name becomes input name self
you ID the comms input you ID.
Now you might be wondering well this is kind of identical to a class.
Why are you using this over the other one or vice versa.
Here are the two things that are different between them.
First of all destructs can not have inheritance inheritance for starters like that child that gets left
behind.
Nobody gives him anything no inheritance so if you try to make user a member of the string is actually
going to give you an error saying that hey why are you trying to do is Throgs can not have subclassing
or they cannot inherit from anyone.
That's part of one part too and this is a very important one part to instruct past value while classes
pass the pointer or the memory location because of that the strokes are a lot faster or a lot faster.
Not a lot of discussions online about which one is better and why you should use this one or the other
one.
I have my own really specific set of you know personal favorites and I would actually go to the link
for you guys to a long discussion on a stack overflow which I really commend you guys at least trying
to skim through it get some sense of what the guys are suggesting.
But heres a rule of thumb for you use destructs unless you need classes.
So as long as you can get away with this Throgs just use them.
If you have a reason to use classes then you must go for class.
The reason I started with classes is simply because classes are like a fundamental part of object oriented
programming.
And we kind of needed to get started with those.
But in practice whatever you want to do if you can use a structure for it just use that and you dont
need to go for classes.
But if youre doing something like are propertyless thing application that there has to be inheritance
between different classes and objects then you need to go with classes.
Otherwise for most everything you can use a struct.
And stocks are a lot lot faster.
So with that in mind once again I really encourage you to read the posts that I have in the description
of this lesson on this one.