1 00:00:00,560 --> 00:00:01,200 Hello. 2 00:00:01,250 --> 00:00:02,930 Welcome to the session on. 3 00:00:02,930 --> 00:00:05,030 Object Oriented Programming. 4 00:00:06,700 --> 00:00:16,660 Object oriented programming is a programming style that is associated with the concept of class objects 5 00:00:17,080 --> 00:00:23,430 and various other concepts revolving around these two. 6 00:00:23,460 --> 00:00:27,690 There are three widely used programming styles. 7 00:00:27,690 --> 00:00:31,590 One is procedural programming. 8 00:00:31,590 --> 00:00:37,150 Functional programming and then Object Oriented Programming. 9 00:00:37,200 --> 00:00:44,040 Python supports all these three programming styles or approaches. 10 00:00:44,510 --> 00:00:54,150 We are interested to know about object oriented programming object oriented programming is an approach 11 00:00:54,150 --> 00:01:03,090 to programming that uses objects and their interactions to design applications and computer programs 12 00:01:03,990 --> 00:01:14,490 object oriented programming models real world things as software objects which have some data associated 13 00:01:14,490 --> 00:01:20,480 with them and can perform certain functions. 14 00:01:20,570 --> 00:01:33,040 For example an object could represent a human being with properties such as name age height weight address 15 00:01:33,160 --> 00:01:43,860 etc. and a human being can perform functions such as walk dog run sleep eat etc.. 16 00:01:43,960 --> 00:01:47,860 Another example of an object is a car. 17 00:01:47,860 --> 00:01:58,780 A car can have properties like modern brand car load mileage year of manufacture etc. and some of the 18 00:01:58,840 --> 00:02:02,640 actions that can be performed on the card object. 19 00:02:02,740 --> 00:02:14,090 We can start the engine accelerate the car apply brakes and stop engine being rolled objects have a 20 00:02:14,090 --> 00:02:28,360 property also known as data odd state and they also can perform functions or behavior and the aim of 21 00:02:28,660 --> 00:02:32,020 object oriented programming is to imitate this. 22 00:02:32,050 --> 00:02:40,900 In terms of software so that objects in software have two entities attached to them the data and the 23 00:02:40,900 --> 00:02:47,260 function and object in programming that has two entities attached to it. 24 00:02:47,290 --> 00:02:59,680 One is the data and the other the things that act on this data also known as functions. 25 00:02:59,780 --> 00:03:08,900 The data are called the attributes of the object and the functions attached to the object which act 26 00:03:08,990 --> 00:03:20,570 on the data are called methods method of the object we've been working on a lot of Python objects in 27 00:03:20,650 --> 00:03:27,130 of course for example strings Python strings are objects. 28 00:03:27,260 --> 00:03:35,250 Say for example when we define a variable a in a sine the text like this. 29 00:03:35,300 --> 00:03:44,430 This means a is an object which is binding to this string. 30 00:03:44,590 --> 00:03:51,070 And now we can have methods that act upon this object. 31 00:03:51,070 --> 00:03:55,550 Say for example I'm going to call the method upper 32 00:03:58,910 --> 00:04:08,870 on this object and this is going to change the state all the data contained in this object 33 00:04:11,710 --> 00:04:22,730 similarly integer list flawed boolean are different Python objects so we have discussed that object 34 00:04:22,730 --> 00:04:32,390 oriented programming is associated with the concept of class and object so we know what an object is. 35 00:04:32,390 --> 00:04:43,100 We will talk about a class you can think of a class as an idea for how something should be defined. 36 00:04:43,280 --> 00:04:51,080 So it is something like blueprint for how something should be defined but it doesn't actually provide 37 00:04:51,170 --> 00:04:53,660 a neat ideal content itself. 38 00:04:53,660 --> 00:05:06,740 So here we have defined a class named God and this class gives us a structure to define various objects. 39 00:05:06,740 --> 00:05:16,010 So in this class we have defined some attribute for the object that can be associated with an object 40 00:05:16,370 --> 00:05:29,000 and yet we have a method that acts upon the object or the data and in a class both the data that is 41 00:05:29,000 --> 00:05:42,250 the attribute and the functions or methods that will be operating on this data are bundled as a unit. 42 00:05:42,250 --> 00:05:49,560 And when we define a class only the description for the object is defined. 43 00:05:49,740 --> 00:05:57,240 There is no object created yet so no memory or storage is allocated. 44 00:05:57,390 --> 00:06:07,750 Then the class is defined and when we define a function in Python we use the key word. 45 00:06:07,820 --> 00:06:19,710 Def D E F then we define a class we use the keyword class like this and then we add the name of the 46 00:06:19,710 --> 00:06:28,980 class beginning with a capital letter as soon as we define a class a new class object is created with 47 00:06:28,980 --> 00:06:31,230 the same name. 48 00:06:31,560 --> 00:06:40,350 And this class object allows us to access these different attributes as well as to create new objects 49 00:06:40,680 --> 00:06:50,760 of this class because a class acts like a blueprint we can use this blueprint Greek to create real objects 50 00:06:50,850 --> 00:06:52,160 of this class. 51 00:06:52,170 --> 00:06:57,480 So now let's see how we can create objects of D Class Carl.