In this session, people called for the concept, so let us first of all see what will happen if we
don't have the concept.
OK, so first of all, let's create something.
So let's say I have a classroom and I want to have details of certain students with me.
So let me create some students.
So let us start with it.
So my students are student one, which is.
So here are my students.
So the first student is Munsie, age twenty eight data scientist, the Nezha 20 developer, Kanika 38
Consulting.
So these are just three students that I have now for these three students if I have to bring them in.
So what I can do is now here, if you see the data type, here is a list.
So the information for my each student is stored in a list so I can access these name age Angledool
using the indexes.
So how would I do that?
I can simply call it out and say your name is and then give the student name, student's identity and
the index for that particular value, which I want to retrieve.
So if I had done this, I can see that this is the name.
This is the name.
Now, if I will be doing that again and again, so I will have to create several students.
So all these students will have some good were in 2003.
So all these will be present and I will have led to ten thousand twenty thousand students.
So I will need to have those 20000 variables which will hold all these values for me.
Now let us try to create something.
Let us try to retrieve these values and let us do that without object oriented programming.
So how we do that is so.
So let's create a function here.
OK, so I'm created a function that says I'm defining the function, create the person I'm this great
person will need an object.
So some information.
So what is this information?
I want to get the information of some student.
So let's say it will take some value.
So let's say it will take a list of student and what will we do for the we need certain values associated.
So let's create some global variables.
Now, why am I creating global variables?
Because if I will not create global variables, then whatever variable I will be creating in this particular
function, the variables will not be accessible outside.
So there will be no use of creating those variables.
So what I can do is I will create some global variables, so say global, and I will say name, age
and rule.
Next, I'll say name is equal to say two then and the index one index.
Similarly, I will have four age and rule.
So I have these now, I will bring these values I see and I am printing name and ID, so I will say
my name is this for my name and I'll see
space.
Age is.
So this will bring water values for me now, I can simply create a person, so I think the person selling
the person and I will put industry insiders, shouldn't one.
So in this, I am putting the value for student once we get the list from here and I can see behind
me.
So if I read this, you can see this is getting the name out outside, although I can see the name here.
Now, if I say print age, I can see that age also now four dead in the same cord.
If I can create the person and get the name and age from student to, I guarantee, the respective name
and age.
So here I'm getting Munsie 28 and 20.
So what happens here is that the labels which I have created are getting overwritten.
So whatever information was saved in this name and age, the information will not carry forward in these
two videos because it will be overridden by the information which is present in the student.
Now, if I don't want to use the same video because I want to still want to keep these values, then
I will have to create different variables or name one, age one.
So in that case, I will be able to get these values again.
So I will be able to retrieve these values again.
So what will happen here is that I will have to create different variables and for different variables,
I will have to see a and with those which will be a very keisters, I will not be able to actually find
out which ones I'm using and to provide those is a very messy job.
So it will be very difficult for us.
So what we will be doing is now we will be using object oriented programming.
So how do we do that?
So I'll just report this.
So now we will use objects.
How would we do that?
So we will see the DOPs.
So what do we do here?
So now we will be creating a class.
Now there are different things which I will be using here and creating.
You need not worry about the syntax.
You need not worry about how I am writing the code as of now because we will be seeing that later.
But right now you just need to get the infusion back.
What am I trying to do?
How I'm doing it.
Well, how do we write that code?
You need not worry about that right now because we will be doing that later.
So let's go ahead with it.
So first of all, I'm creating a class.
How do we create a class B, C class?
Give the class name.
So my last name is say person.
Person is my class name because it is a class name.
It is said that you should give the first character as a captain.
Now inside this I will see Self and I luzzi person.
Now this person will for the information about the person I'm the self.
You can for now consider this that this is a mandatory thing.
When you are creating a class, you need to put in the same thing in it again.
Just remember this thing.
Just remember this as a syntax.
You don't need to understand why am I doing this as of now.
But we need to do that.
What for now, when we create the function, then this is the class.
In this class, I will have different functions and different attributes.
What are those functions called now inside the class?
When I'm declaring a function, when I'm writing a function inside of class, it is called a method.
OK, so now we will not be writing functions.
We are writing methods.
So this is a different functions I what we are creating outside the classes.
But when we create a function inside a class that is scholder method, let's go ahead.
So how do we do that.
We see then just how they have been creating functions ever since.
So Dev and I say create person.
Looks familiar.
Let's go in person, I'm this great person needs what this creative person needs.
Now, you need not for this here.
As of now, this doesn't need to be here.
It needs to be here.
So we see self and we say, OK, so we are putting self inside this and the information about the person.
And then we go ahead and then we put a little more information services self, not name, self age.
So not really.
Now we have saudade, name, age and now what are these name, General?
These are the attributes of the class person.
So this person will have some name, age and rule associated with himself or herself.
Now, how do we how will we understand that this is something which is related to that person?
And it is not a very it is not a common variable.
It is not a common media.
We would be use inside the code just like that.
Maybe I want to keep account of people just let's see.
I want to create account of people.
So in that case, I might be having something will seek out and it will have led to somebody with maybe
now each time that I create a person, this will increment the cup.
So I'm just keeping track of the count so I can have something like GONGED is equal to count plus one.
And what will happen this count is not something which is attached to this person.
This account is a variable which is not related to this person.
Plus, this is something which I have for myself or my entire board.
It is something different.
So this person has his own name, age, and why this count remains common to the entire.
So no matter if I have been a thousand people in created using this class person, I will still have
just one count really vital for each and every person.
I will have a different name, different age, different role.
Now, how will I find out which name, which age and which is all I am talking about, for which person
I'm talking about.
That is why we need this.
When I say self-taught name, self-taught, self-taught person, that means that I am referring to the
name age and the role of the person which I am creating.
We'll see that.
We'll have a look at how we do that.
So let's go forward.
This is the first one now for the let me bring something.
So let me bring a little information so we see the person.
What is the name of the person name now because I want to refer to the name of the person which I am
creating.
So I saved your name and I put.
Has been created.
OK, this is this now and created and let me add the candles out.
So this is it will give me the count of the number and the other details accordingly.
OK, now let's go ahead.
So I have this and all these things now for the let me display the person, so I'll simply say death
and similarly I create a function to bring this.
So now we have this display person.
Now, this will have what?
This will have different being done.
So how will we do that?
We see the name of the person is self taught me and the age of the person is self-taught age and the
profession of the person is self-taught.
Really.
OK, now we have these details.
Now what we will do is now this is our class, OK?
Now this class, what does this class do?
This class will create a person and it will display the information regarding that person.
Now they'll know nothing has been done.
We have just created a layout.
Now, when we create a class, when we write the class, we are just creating a template.
OK, now how we use this template is using an object.
Now, how will we do that?
So now I'm creating a dummy object.
OK, so let me create a dummy object.
Now what will the what were the different people would be which we had.
So we had this Monsey New High and Gannicus.
So these were the three students which we had.
So let's create an object for these.
So what are the objects?
So I create an object.
Munsie I create this thing person.
So now I have created an object.
Munsie.
OK, now I create another object Samiha and I create an object using person.
Now every time I run this code, right, every time I done this, it creates an object.
So we'll see how it is.
So let's create the last one to connect the antipode person again.
Now let me run this.
OK, now I have done this.
Now let's see further.
OK, now when I see the type of marqusee it says mean person.
So this says that this is a person, Manti's, a person.
Let us see the type of person what this person person is they object to a person is basically a class.
OK, now let us go for them now, Bill.
No, it doesn't hold anything.
Munsie has no values, OK?
Munsie is just present then, but there are no values.
Let us see.
Munsie dot ne.
So if I want to find out if I want to use particular values which are present in this class, I have
to use a dot operator.
OK, if I want to use the attributes.
But as in the class that does name a drawing, then I will use this dot operators.
Let me run this see person object has to be named because now we have not instantiated anything.
It has no such attribute.
Now what we will do now we have this munsie now I will create the person.
So first of all, I have to run this function.
So let me do this line.
I will create
a person.
So when I say mantic dot create person, it will create a person for me.
Now how will, how will we create the person now see this create a person needs certain information.
What is the certain information.
It needs self and it needs the person.
When says we don't have to pass anything, it will take whatever information is present inside.
Munsie this object which I have created, that is the object and it will put that by default.
So you don't have to use this.
You don't have to put anything in the set.
OK, this is automatically taken care of now.
We need to put in the person now that is the person.
So let's go back and remember, we created the student one student to student three.
So this already holds the required information.
OK, so I put this student one inside this.
Create person, student one.
OK, I, I run this.
OK, just a moment, it needs this underscore saying so you see, when I put this here, there was on
school present here.
So here I have got the underscore.
So I'm doing Montegut, don't create person.
And I've put this one inside.
This what it has done this this student one is a list.
This list contains what it contains the name, age and rule.
So it takes those values and it creates a person.
Now, it takes these values from this person and it puts it in Dusseldorf name self-taught age self-control.
So this self contains what the self contains, all the values which are associated with Munsie, all
the values which are associated with this particular object.
OK, so I created this.
Now let us go for it.
OK, now if I do display person, ok, I'll create this person so I can see this
person and which person I'm displaying I'm for displaying.
So I you need to use it using munsie dot display person.
OK, so I get this mounted display person.
Now what will happen.
I'll run this.
It says Monte has been created because of this and from this display person it is displaying the entire
sentence which we had.
That is name of the person.
Is this age of the person.
Is this proportion of the person, is this right?
All this information has been printed for me.
Now, similarly, I can create multiple people, right.
I can use this and create the other dugal.
So I have this Nezha
now and I put all here and I heard one also Swanzy.
And I put.
OK, and I'll put three here tonight on this, it is saying May has been created and the debate is going
to has been created and the details now I have all these values now each time I want to access the attributes.
Now, what was the problem here?
What was the problem in case without boots?
Each time when I had to find out the name and age, I will have to create a new reality when I'm keeping
track of those variables.
But now what I can do is I can directly use the object.
So here I have the object.
Nezha No.
See, it has been created before Guernica.
So if there was some trouble of getting over it and then it would have overridden.
OK, but now what we simply have to do is we will say, huh, doc?
Maybe we can see the value and we can put the same thing, OK?
We can put the image, we can put rule.
I can access all the details.
OK, so it is as simple as that.
I just need to create an object.
And using that object, I can run these methods, I can run these methods on top of these objects,
and I can also create and modify the variables, these attributes that is name age rule.
You can have any number of attributes and you can modify those also.
So this is how we will be using object oriented programming and this is how it is so useful and so easy
to use.
OK, now the next thing which we will be learning about is the concept of object and class, how we
actually create the objects in class and the perfect way of doing it.
And now what we have seen is just how it looks like.
But we will be going in depth on this in the next session.
Thank you.