WEBVTT

00:01.140 --> 00:11.070
In this session, people called for the concept, so let us first of all see what will happen if we

00:11.070 --> 00:13.290
don't have the concept.

00:14.010 --> 00:18.060
OK, so first of all, let's create something.

00:18.060 --> 00:25.850
So let's say I have a classroom and I want to have details of certain students with me.

00:26.370 --> 00:28.120
So let me create some students.

00:28.140 --> 00:31.390
So let us start with it.

00:31.710 --> 00:40.950
So my students are student one, which is.

00:45.540 --> 00:47.050
So here are my students.

00:47.080 --> 00:54.540
So the first student is Munsie, age twenty eight data scientist, the Nezha 20 developer, Kanika 38

00:54.540 --> 00:55.200
Consulting.

00:55.560 --> 01:02.640
So these are just three students that I have now for these three students if I have to bring them in.

01:03.150 --> 01:07.320
So what I can do is now here, if you see the data type, here is a list.

01:07.950 --> 01:15.440
So the information for my each student is stored in a list so I can access these name age Angledool

01:15.750 --> 01:17.280
using the indexes.

01:17.550 --> 01:18.650
So how would I do that?

01:18.660 --> 01:26.640
I can simply call it out and say your name is and then give the student name, student's identity and

01:26.640 --> 01:31.110
the index for that particular value, which I want to retrieve.

01:32.610 --> 01:35.440
So if I had done this, I can see that this is the name.

01:35.460 --> 01:36.000
This is the name.

01:36.580 --> 01:43.680
Now, if I will be doing that again and again, so I will have to create several students.

01:43.690 --> 01:46.550
So all these students will have some good were in 2003.

01:46.710 --> 01:51.150
So all these will be present and I will have led to ten thousand twenty thousand students.

01:51.390 --> 01:58.290
So I will need to have those 20000 variables which will hold all these values for me.

01:59.240 --> 02:02.630
Now let us try to create something.

02:02.640 --> 02:08.770
Let us try to retrieve these values and let us do that without object oriented programming.

02:09.060 --> 02:13.230
So how we do that is so.

02:18.210 --> 02:21.090
So let's create a function here.

02:21.240 --> 02:29.970
OK, so I'm created a function that says I'm defining the function, create the person I'm this great

02:29.970 --> 02:33.480
person will need an object.

02:33.570 --> 02:35.130
So some information.

02:35.160 --> 02:36.480
So what is this information?

02:36.480 --> 02:39.310
I want to get the information of some student.

02:39.510 --> 02:42.340
So let's say it will take some value.

02:42.400 --> 02:56.310
So let's say it will take a list of student and what will we do for the we need certain values associated.

02:56.340 --> 02:59.940
So let's create some global variables.

03:00.300 --> 03:03.090
Now, why am I creating global variables?

03:03.240 --> 03:11.250
Because if I will not create global variables, then whatever variable I will be creating in this particular

03:11.850 --> 03:15.730
function, the variables will not be accessible outside.

03:16.830 --> 03:20.790
So there will be no use of creating those variables.

03:21.330 --> 03:29.160
So what I can do is I will create some global variables, so say global, and I will say name, age

03:29.700 --> 03:30.300
and rule.

03:31.350 --> 03:38.930
Next, I'll say name is equal to say two then and the index one index.

03:39.990 --> 03:44.940
Similarly, I will have four age and rule.

03:58.910 --> 04:08.480
So I have these now, I will bring these values I see and I am printing name and ID, so I will say

04:09.180 --> 04:17.870
my name is this for my name and I'll see

04:20.010 --> 04:21.260
space.

04:24.620 --> 04:25.940
Age is.

04:31.940 --> 04:42.860
So this will bring water values for me now, I can simply create a person, so I think the person selling

04:44.180 --> 04:49.210
the person and I will put industry insiders, shouldn't one.

04:50.620 --> 04:58.680
So in this, I am putting the value for student once we get the list from here and I can see behind

05:00.380 --> 05:00.740
me.

05:01.300 --> 05:07.190
So if I read this, you can see this is getting the name out outside, although I can see the name here.

05:07.880 --> 05:16.520
Now, if I say print age, I can see that age also now four dead in the same cord.

05:16.520 --> 05:27.380
If I can create the person and get the name and age from student to, I guarantee, the respective name

05:27.380 --> 05:27.920
and age.

05:28.070 --> 05:30.690
So here I'm getting Munsie 28 and 20.

05:30.950 --> 05:36.550
So what happens here is that the labels which I have created are getting overwritten.

05:36.950 --> 05:44.690
So whatever information was saved in this name and age, the information will not carry forward in these

05:44.690 --> 05:49.150
two videos because it will be overridden by the information which is present in the student.

05:50.240 --> 05:56.120
Now, if I don't want to use the same video because I want to still want to keep these values, then

05:56.120 --> 06:01.100
I will have to create different variables or name one, age one.

06:01.490 --> 06:06.580
So in that case, I will be able to get these values again.

06:06.590 --> 06:08.720
So I will be able to retrieve these values again.

06:08.990 --> 06:14.990
So what will happen here is that I will have to create different variables and for different variables,

06:14.990 --> 06:23.900
I will have to see a and with those which will be a very keisters, I will not be able to actually find

06:23.900 --> 06:28.960
out which ones I'm using and to provide those is a very messy job.

06:28.970 --> 06:30.740
So it will be very difficult for us.

06:31.790 --> 06:35.820
So what we will be doing is now we will be using object oriented programming.

06:36.290 --> 06:37.410
So how do we do that?

06:37.440 --> 06:39.880
So I'll just report this.

06:42.920 --> 06:44.550
So now we will use objects.

06:44.990 --> 06:46.020
How would we do that?

06:46.400 --> 06:50.450
So we will see the DOPs.

06:51.650 --> 06:52.880
So what do we do here?

06:53.120 --> 06:56.360
So now we will be creating a class.

06:57.020 --> 07:02.360
Now there are different things which I will be using here and creating.

07:02.690 --> 07:04.820
You need not worry about the syntax.

07:04.820 --> 07:11.150
You need not worry about how I am writing the code as of now because we will be seeing that later.

07:11.480 --> 07:14.980
But right now you just need to get the infusion back.

07:15.410 --> 07:17.070
What am I trying to do?

07:17.090 --> 07:18.250
How I'm doing it.

07:18.270 --> 07:19.820
Well, how do we write that code?

07:19.820 --> 07:23.100
You need not worry about that right now because we will be doing that later.

07:24.140 --> 07:25.770
So let's go ahead with it.

07:26.090 --> 07:28.090
So first of all, I'm creating a class.

07:28.100 --> 07:30.260
How do we create a class B, C class?

07:31.400 --> 07:32.490
Give the class name.

07:32.680 --> 07:35.510
So my last name is say person.

07:36.590 --> 07:39.340
Person is my class name because it is a class name.

07:39.680 --> 07:46.340
It is said that you should give the first character as a captain.

07:47.570 --> 07:54.670
Now inside this I will see Self and I luzzi person.

07:55.010 --> 07:59.900
Now this person will for the information about the person I'm the self.

07:59.900 --> 08:03.140
You can for now consider this that this is a mandatory thing.

08:03.140 --> 08:07.610
When you are creating a class, you need to put in the same thing in it again.

08:08.180 --> 08:09.590
Just remember this thing.

08:09.710 --> 08:11.480
Just remember this as a syntax.

08:11.480 --> 08:14.510
You don't need to understand why am I doing this as of now.

08:14.780 --> 08:16.340
But we need to do that.

08:17.720 --> 08:24.800
What for now, when we create the function, then this is the class.

08:24.800 --> 08:30.100
In this class, I will have different functions and different attributes.

08:30.110 --> 08:33.380
What are those functions called now inside the class?

08:33.600 --> 08:40.940
When I'm declaring a function, when I'm writing a function inside of class, it is called a method.

08:41.630 --> 08:44.900
OK, so now we will not be writing functions.

08:45.110 --> 08:46.550
We are writing methods.

08:46.700 --> 08:50.960
So this is a different functions I what we are creating outside the classes.

08:50.960 --> 08:56.580
But when we create a function inside a class that is scholder method, let's go ahead.

08:56.930 --> 08:58.070
So how do we do that.

08:58.070 --> 09:02.690
We see then just how they have been creating functions ever since.

09:03.140 --> 09:05.960
So Dev and I say create person.

09:09.040 --> 09:10.150
Looks familiar.

09:12.220 --> 09:20.090
Let's go in person, I'm this great person needs what this creative person needs.

09:20.170 --> 09:22.570
Now, you need not for this here.

09:22.570 --> 09:25.630
As of now, this doesn't need to be here.

09:25.900 --> 09:26.800
It needs to be here.

09:27.610 --> 09:36.940
So we see self and we say, OK, so we are putting self inside this and the information about the person.

09:36.940 --> 09:49.330
And then we go ahead and then we put a little more information services self, not name, self age.

09:50.050 --> 09:52.680
So not really.

09:53.380 --> 09:58.890
Now we have saudade, name, age and now what are these name, General?

09:59.170 --> 10:04.150
These are the attributes of the class person.

10:04.360 --> 10:12.520
So this person will have some name, age and rule associated with himself or herself.

10:13.360 --> 10:20.230
Now, how do we how will we understand that this is something which is related to that person?

10:20.560 --> 10:23.850
And it is not a very it is not a common variable.

10:24.160 --> 10:25.390
It is not a common media.

10:25.400 --> 10:28.540
We would be use inside the code just like that.

10:28.540 --> 10:33.090
Maybe I want to keep account of people just let's see.

10:33.160 --> 10:34.690
I want to create account of people.

10:34.930 --> 10:40.950
So in that case, I might be having something will seek out and it will have led to somebody with maybe

10:42.070 --> 10:47.680
now each time that I create a person, this will increment the cup.

10:47.680 --> 10:59.040
So I'm just keeping track of the count so I can have something like GONGED is equal to count plus one.

10:59.230 --> 11:05.110
And what will happen this count is not something which is attached to this person.

11:05.980 --> 11:10.230
This account is a variable which is not related to this person.

11:10.240 --> 11:13.870
Plus, this is something which I have for myself or my entire board.

11:14.320 --> 11:15.490
It is something different.

11:15.680 --> 11:24.090
So this person has his own name, age, and why this count remains common to the entire.

11:24.370 --> 11:30.280
So no matter if I have been a thousand people in created using this class person, I will still have

11:30.460 --> 11:35.140
just one count really vital for each and every person.

11:35.140 --> 11:38.410
I will have a different name, different age, different role.

11:38.590 --> 11:44.740
Now, how will I find out which name, which age and which is all I am talking about, for which person

11:44.740 --> 11:45.580
I'm talking about.

11:46.060 --> 11:48.240
That is why we need this.

11:50.410 --> 11:58.750
When I say self-taught name, self-taught, self-taught person, that means that I am referring to the

11:58.750 --> 12:02.980
name age and the role of the person which I am creating.

12:04.120 --> 12:05.020
We'll see that.

12:05.350 --> 12:08.890
We'll have a look at how we do that.

12:08.950 --> 12:09.910
So let's go forward.

12:12.070 --> 12:16.060
This is the first one now for the let me bring something.

12:17.800 --> 12:25.660
So let me bring a little information so we see the person.

12:28.390 --> 12:36.730
What is the name of the person name now because I want to refer to the name of the person which I am

12:36.730 --> 12:37.330
creating.

12:37.330 --> 12:43.780
So I saved your name and I put.

12:51.440 --> 12:54.230
Has been created.

12:54.480 --> 13:04.610
OK, this is this now and created and let me add the candles out.

13:09.500 --> 13:15.070
So this is it will give me the count of the number and the other details accordingly.

13:17.070 --> 13:20.670
OK, now let's go ahead.

13:22.680 --> 13:31.400
So I have this and all these things now for the let me display the person, so I'll simply say death

13:32.730 --> 13:35.460
and similarly I create a function to bring this.

13:37.470 --> 13:39.850
So now we have this display person.

13:40.380 --> 13:41.580
Now, this will have what?

13:41.580 --> 13:43.200
This will have different being done.

13:43.500 --> 13:44.580
So how will we do that?

13:44.580 --> 13:54.120
We see the name of the person is self taught me and the age of the person is self-taught age and the

13:54.120 --> 13:56.650
profession of the person is self-taught.

13:56.670 --> 13:57.090
Really.

13:57.450 --> 13:59.490
OK, now we have these details.

13:59.880 --> 14:02.690
Now what we will do is now this is our class, OK?

14:03.000 --> 14:05.220
Now this class, what does this class do?

14:05.670 --> 14:11.710
This class will create a person and it will display the information regarding that person.

14:12.090 --> 14:14.180
Now they'll know nothing has been done.

14:14.280 --> 14:15.990
We have just created a layout.

14:16.440 --> 14:21.450
Now, when we create a class, when we write the class, we are just creating a template.

14:22.210 --> 14:27.180
OK, now how we use this template is using an object.

14:27.390 --> 14:28.570
Now, how will we do that?

14:28.770 --> 14:30.960
So now I'm creating a dummy object.

14:31.170 --> 14:33.430
OK, so let me create a dummy object.

14:33.450 --> 14:36.570
Now what will the what were the different people would be which we had.

14:36.960 --> 14:39.540
So we had this Monsey New High and Gannicus.

14:39.540 --> 14:41.770
So these were the three students which we had.

14:43.020 --> 14:46.770
So let's create an object for these.

14:46.980 --> 14:48.050
So what are the objects?

14:48.050 --> 14:49.170
So I create an object.

14:49.170 --> 14:55.110
Munsie I create this thing person.

14:56.250 --> 14:58.350
So now I have created an object.

14:58.740 --> 14:59.270
Munsie.

14:59.820 --> 15:07.250
OK, now I create another object Samiha and I create an object using person.

15:08.700 --> 15:14.760
Now every time I run this code, right, every time I done this, it creates an object.

15:15.420 --> 15:16.720
So we'll see how it is.

15:17.070 --> 15:25.310
So let's create the last one to connect the antipode person again.

15:25.950 --> 15:27.180
Now let me run this.

15:27.540 --> 15:29.340
OK, now I have done this.

15:29.590 --> 15:30.870
Now let's see further.

15:31.110 --> 15:41.930
OK, now when I see the type of marqusee it says mean person.

15:41.970 --> 15:45.010
So this says that this is a person, Manti's, a person.

15:45.360 --> 15:53.940
Let us see the type of person what this person person is they object to a person is basically a class.

15:54.530 --> 15:57.530
OK, now let us go for them now, Bill.

15:57.540 --> 15:59.820
No, it doesn't hold anything.

16:00.420 --> 16:02.820
Munsie has no values, OK?

16:02.820 --> 16:05.550
Munsie is just present then, but there are no values.

16:05.550 --> 16:06.210
Let us see.

16:06.210 --> 16:09.050
Munsie dot ne.

16:09.780 --> 16:17.250
So if I want to find out if I want to use particular values which are present in this class, I have

16:17.250 --> 16:19.450
to use a dot operator.

16:20.160 --> 16:23.370
OK, if I want to use the attributes.

16:23.370 --> 16:28.620
But as in the class that does name a drawing, then I will use this dot operators.

16:28.640 --> 16:38.640
Let me run this see person object has to be named because now we have not instantiated anything.

16:39.060 --> 16:40.770
It has no such attribute.

16:41.310 --> 16:48.130
Now what we will do now we have this munsie now I will create the person.

16:48.150 --> 16:50.380
So first of all, I have to run this function.

16:50.850 --> 16:52.170
So let me do this line.

16:52.260 --> 16:53.190
I will create

16:56.360 --> 16:57.110
a person.

16:57.330 --> 17:00.910
So when I say mantic dot create person, it will create a person for me.

17:00.930 --> 17:08.480
Now how will, how will we create the person now see this create a person needs certain information.

17:08.490 --> 17:09.960
What is the certain information.

17:10.380 --> 17:14.760
It needs self and it needs the person.

17:15.840 --> 17:25.290
When says we don't have to pass anything, it will take whatever information is present inside.

17:25.290 --> 17:33.320
Munsie this object which I have created, that is the object and it will put that by default.

17:33.480 --> 17:36.030
So you don't have to use this.

17:36.030 --> 17:38.420
You don't have to put anything in the set.

17:38.760 --> 17:42.420
OK, this is automatically taken care of now.

17:42.420 --> 17:46.130
We need to put in the person now that is the person.

17:46.440 --> 17:51.240
So let's go back and remember, we created the student one student to student three.

17:51.510 --> 17:54.460
So this already holds the required information.

17:54.480 --> 17:57.570
OK, so I put this student one inside this.

17:59.990 --> 18:02.480
Create person, student one.

18:03.230 --> 18:05.540
OK, I, I run this.

18:09.190 --> 18:17.290
OK, just a moment, it needs this underscore saying so you see, when I put this here, there was on

18:17.380 --> 18:18.180
school present here.

18:18.550 --> 18:20.410
So here I have got the underscore.

18:20.410 --> 18:22.750
So I'm doing Montegut, don't create person.

18:22.750 --> 18:24.850
And I've put this one inside.

18:24.850 --> 18:28.450
This what it has done this this student one is a list.

18:28.750 --> 18:32.360
This list contains what it contains the name, age and rule.

18:33.340 --> 18:37.620
So it takes those values and it creates a person.

18:37.810 --> 18:45.000
Now, it takes these values from this person and it puts it in Dusseldorf name self-taught age self-control.

18:45.370 --> 18:55.660
So this self contains what the self contains, all the values which are associated with Munsie, all

18:55.660 --> 18:58.750
the values which are associated with this particular object.

18:59.270 --> 19:01.820
OK, so I created this.

19:02.380 --> 19:04.890
Now let us go for it.

19:05.260 --> 19:12.340
OK, now if I do display person, ok, I'll create this person so I can see this

19:15.220 --> 19:20.740
person and which person I'm displaying I'm for displaying.

19:21.670 --> 19:28.770
So I you need to use it using munsie dot display person.

19:29.110 --> 19:31.770
OK, so I get this mounted display person.

19:32.290 --> 19:33.460
Now what will happen.

19:33.580 --> 19:34.510
I'll run this.

19:34.840 --> 19:43.060
It says Monte has been created because of this and from this display person it is displaying the entire

19:43.060 --> 19:44.230
sentence which we had.

19:44.470 --> 19:45.790
That is name of the person.

19:45.790 --> 19:47.050
Is this age of the person.

19:47.050 --> 19:50.380
Is this proportion of the person, is this right?

19:50.470 --> 19:53.230
All this information has been printed for me.

19:54.400 --> 19:57.880
Now, similarly, I can create multiple people, right.

19:57.970 --> 20:02.130
I can use this and create the other dugal.

20:02.740 --> 20:06.660
So I have this Nezha

20:10.030 --> 20:20.320
now and I put all here and I heard one also Swanzy.

20:23.530 --> 20:24.600
And I put.

20:27.750 --> 20:35.280
OK, and I'll put three here tonight on this, it is saying May has been created and the debate is going

20:35.280 --> 20:41.700
to has been created and the details now I have all these values now each time I want to access the attributes.

20:41.730 --> 20:43.090
Now, what was the problem here?

20:43.350 --> 20:45.330
What was the problem in case without boots?

20:45.630 --> 20:50.730
Each time when I had to find out the name and age, I will have to create a new reality when I'm keeping

20:50.730 --> 20:52.040
track of those variables.

20:52.260 --> 20:56.220
But now what I can do is I can directly use the object.

20:56.220 --> 20:57.870
So here I have the object.

20:57.870 --> 20:58.400
Nezha No.

20:58.410 --> 21:01.100
See, it has been created before Guernica.

21:01.350 --> 21:05.270
So if there was some trouble of getting over it and then it would have overridden.

21:05.280 --> 21:10.020
OK, but now what we simply have to do is we will say, huh, doc?

21:10.680 --> 21:16.780
Maybe we can see the value and we can put the same thing, OK?

21:17.100 --> 21:21.920
We can put the image, we can put rule.

21:23.190 --> 21:24.960
I can access all the details.

21:25.420 --> 21:27.780
OK, so it is as simple as that.

21:28.170 --> 21:30.720
I just need to create an object.

21:32.040 --> 21:39.330
And using that object, I can run these methods, I can run these methods on top of these objects,

21:39.690 --> 21:47.370
and I can also create and modify the variables, these attributes that is name age rule.

21:47.370 --> 21:51.510
You can have any number of attributes and you can modify those also.

21:51.930 --> 22:00.060
So this is how we will be using object oriented programming and this is how it is so useful and so easy

22:00.060 --> 22:00.640
to use.

22:01.440 --> 22:10.140
OK, now the next thing which we will be learning about is the concept of object and class, how we

22:10.140 --> 22:16.140
actually create the objects in class and the perfect way of doing it.

22:16.140 --> 22:19.710
And now what we have seen is just how it looks like.

22:19.920 --> 22:24.640
But we will be going in depth on this in the next session.

22:24.870 --> 22:25.290
Thank you.
