Write going on to when you are quite in five.
For now let's go for the next concept that is backcrosses.
I'll just close all of them.
OK.
So this is when you want to create your own data structure you create a class so you create a class
with just a keyword class.
And let's see if for example I want to create a class so if I want to create a class of friends you
know of an embedded system or let me say let me see iOS device.
OK.
The device says OK let me see class Id devices.
OK.
And of course it's.
Let me just make it.
I ot devices where icecap de-couple out here.
All right.
All I can do is if you remember I had created an image matter where
it method is the one which is used for whenever an object of this particular class is created.
Right.
The inner discord and the object when you know so I can just see we here print an object of clause I
O devices has been created.
Right so if I say out here I can say I can say you know in my in my main code I'm going to create an
object of coyote demises so I added devices is a class name and if I create an object of it let's say
for example in IO devices the first thing that we would think of is maybe you know I'll create an object
call the stress.
So when I get harassed by and is when I create an address by interface a control shift f 10.
Can you see the minute I created this it says an object of class Id devices has been created.
The minute you create an object of a particular class by default the better the school and when the
to school.
OK.
The object which Goldstein it mattered is fast passes itself into the method process itself and as a
result you need to take it in a variable called a sense where it seen that and of course since you know
this is how it works.
All right.
But let's say for example I am creating.
I want to create something more like I need to see what is the name of this particular device.
OK so I need to create the name and I want to create.
What type of device is it comes under control.
It is.
You know it is an equipment or something like that.
So let me see the name of this device can be.
So I'm going to say the name of this device of course rest by.
And it comes under.
It comes under the controller and it comes you know the cost of it comes around.
Let's say three five double.
That's about an approximate cost.
Right.
So now when I if I run this it will give me an error which says if it takes only one position argument
but four were given you give these three plus you give the object.
But it takes only one.
OK.
So you give four but actually one.
So I needed to find this method of protecting the other.
The other part of me just passed let's see for example Russ spice you know digging into an into a local
variable out there Colus name.
Another one called S-type and you need to say the three €500 can be the cost.
Now when I see this let's say for example.
I send this particular you know I send these particular paramita into the unit Mehtar it goes in as
local variables but once it comes out of this method once it comes out of this method these variables
are lost.
These variables are no longer there.
But if I can do something where these really boots or these particular baramin does that I've got if
I can assign them as an attribute to this particular object that I created.
Second if I can assign them as attributes of this particular object that I created then I can access
them anytime I want with the object.
So I can assign them by saying self-taught.
Self-taught mean I'm going to create an attribute call list name for self.
That means for that object I'm going to create an attribute class type for that particular object and
I'm going to say type and Selter cost.
It's going to be equal to the cost.
Right.
OK.
So anytime I want.
I want to access the name of this particular device.
OK the device name is a printed right.
Grin.
The device name is what is it.
Comma the rest by DOT name.
Correct.
And then if I print cost costs what is the cost going to be I need to access it with the object name
dot cost.
So you have this.
So you have this cost which you know which can be displayed so if I do a control shift f 10.
So the device name is Russ by.
And the cost is three fidelity.
So instead of saying instead of saying rest I can say device 1.
So I just need a change because the name of the rasper do I want is I spy.
So let me see.
Each of the device or device one cost.
So I have assigned to device one a name and a cost.
Let's say I create another device let me say device 2 and I say I LTE devices and this time I need to
I need to boss another name.
Let me say the name that I want to posses.
Let me say I want to pass.
Let me see a DMM.
OK.
Our digital multi-meter.
DMM it will be nothing but it's not a controller but it is.
It is an equipment you can see it's an equipment type as an equipment and a way to ease the cost of
the diabetes.
You can see a good one around 500 to 1000 Grange right talking Ghanaian.
And of course you can print the device to details by saying yeah.
Device to dot dot name come on device to dot cost correct control Chidester.
So DMM and the cost of that is 500.
I can keep creating devices having my own custom it's my own custom class my own custom data structure
my own custom attributes which are getting created each time.
Things like that.
Right.
So that's about if for example they create more methods in this let me say def if you create a method
called as if I call if I create a meticulous print details print details it will take a selfie and all
it does is print you know the name of the device
is the name the device is what does it whatever method whatever object calls it I'll say cells name
friend you're going to say it is off type come on Celtel type and I will train cost.
And what's going to be the cost.
So stop cost.
Right.
So this is what we're going to have so I don't need to any more to this printing out here because I
can use that method.
I can just say print no I need to say device 1 I need to call it using an object using an object I'll
call that method call list put in details right and I'll call device to dot green details right.
Control your data.
So when device one device too has been created say is an object of cluster.
I have been paid enough data plus I do the name of the devices that I Spy and is a type controller.
The other DM's of type equipment costs this all right.
One last thing about one last thing about this.
Let's say for example if you want to have a count of the devices being stored in a particular variable
you can create a class attribute count which is you should use zero.
But whenever an object is created you can increment.
You can increment the count of this particular Brierty devices Darktown I can make it plus equal to
1.
Right.
And if you want if you want you know you can create another method def get gownd which is going to which
you get kown can be called by the object as well as by the class.
So I need to create it as a static method.
So I would say at static metor a decree to write which will give me a static method which would be a
static method which can be called a call using a class name as well as window.
What is it return that returns the iOS devices don't count.
Of course if you want to make it count as a private variable which cannot be accessed outside I need
to put an underscore underscore write and I need to it can be accessed now really inside the class right.
I cannot access it anymore.
I'll take the class.
Great.
So here we have so one device one is created.
I need to say print count equal to count equals the comma.
I need to say I have two devices don't get count right.
Or after device 2 was created.
I can say print count now because get called is a static metric and even call it with an object name.
So I call it device to get count.
You can call it with the object name or even with the.
OK.
So Control shift at 10.
So it says an object in the first case counters one next case count was.
So as you create objects more and more the count keeps incrementing whenever an object is created.
Correct.
So this is how we can have a custom class custom data structure created.
That's about the nuts and bolts out here.
OK.
We're now going to go with 2 to two degree concepts and to to higher concepts that we have in some time.
Let's say for example we're now going to go into certain concepts that we didn't cover before but as
a whole it requires the major concept of networking which we're going to deal with in detail in the
next session right up to now.
This was covered maybe in the basics but now we're going to go into something which is which are not
which were not covered earlier.
And we're going to go for the networking part of it in the next session.