1 00:00:00,550 --> 00:00:14,220 I have defined a class God which contains three attributes modern brand and in addition to these three 2 00:00:14,280 --> 00:00:20,690 attributes I have also added two methods in this class. 3 00:00:20,700 --> 00:00:25,220 When does the Start Engine method and the others excel at it. 4 00:00:25,220 --> 00:00:34,650 Method methods add functions defined inside the body of a class and they used to define the behavior 5 00:00:34,950 --> 00:00:40,640 of an object so methods are dependent on the state of the object. 6 00:00:41,750 --> 00:00:50,990 And if you notice here we have used the def keyword d e f d e f key word to define a method inside the 7 00:00:50,990 --> 00:00:58,120 class so you have a structure a blueprint ready. 8 00:00:58,260 --> 00:01:05,610 Now you can use this blueprint to create objects of this type. 9 00:01:05,610 --> 00:01:10,650 The procedure to create an object is similar to a function call. 10 00:01:10,860 --> 00:01:22,290 Once you define a class we can create as many objects of this class as we like and the objects of a 11 00:01:22,290 --> 00:01:24,780 class are called instances. 12 00:01:24,780 --> 00:01:32,000 Detail on that is used for creating a new instance of a class in skull instantiating. 13 00:01:32,070 --> 00:01:36,720 How do you define an object of a class or an instance of a class. 14 00:01:38,210 --> 00:01:42,050 The procedure is similar to a function call. 15 00:01:42,350 --> 00:01:54,860 So here you have the class name followed by parenthesis and this function call is assigned to the instance 16 00:01:54,950 --> 00:01:56,170 of the object. 17 00:01:56,180 --> 00:02:05,720 Say for example you call this object A B C so in order to keep track of the object we have assigned 18 00:02:05,750 --> 00:02:08,560 this function card to a variable. 19 00:02:09,740 --> 00:02:15,050 We can create as many instances of the class as we like. 20 00:02:15,050 --> 00:02:21,810 So let's create another instance we will call this X Y Z. 21 00:02:22,920 --> 00:02:34,940 And here we have the function called so each of these instances A B C and X Y Z. 22 00:02:35,020 --> 00:02:41,010 Completely independent objects with their own properties and methods. 23 00:02:41,170 --> 00:02:48,700 And each of these objects are instances can be manipulated independent of each other. 24 00:02:49,630 --> 00:02:55,620 So this is of a class God in which we have defined two methods. 25 00:02:55,900 --> 00:03:01,090 The first one is the undisclosed underscored in it underscored underscore. 26 00:03:01,810 --> 00:03:05,960 So it also call double underscored in a method. 27 00:03:06,160 --> 00:03:16,280 And the second method is the start engine Method Method that begin with double underscore I'd call special 28 00:03:16,280 --> 00:03:19,790 functions as they have special meaning. 29 00:03:19,830 --> 00:03:30,600 Here we have the inert metal the init method gets called automatically when a new object of the class 30 00:03:30,690 --> 00:03:40,710 is instantiated the init method also known as a constructor is used to set the state of the objects 31 00:03:40,830 --> 00:03:42,230 attributes. 32 00:03:42,240 --> 00:03:52,060 So here I have defined a new object to IDB by calling the last name and I have custody arguments the 33 00:03:52,120 --> 00:04:01,330 arguments that are passed to the class name given to it in it method and we will never have to call 34 00:04:01,330 --> 00:04:02,910 the init method. 35 00:04:02,950 --> 00:04:12,280 It gets called automatically when we create a new instance of a new object like other functions method 36 00:04:12,880 --> 00:04:23,680 and init method can dig any number of arguments so we will not get into the body of the init method 37 00:04:25,550 --> 00:04:34,580 so we have not understood that the argument that we passed to the last name given to the init method 38 00:04:35,540 --> 00:04:40,140 in the definition of the init method we have four parameters. 39 00:04:40,400 --> 00:04:52,160 The first one is the self parameter and then we have the model brand and ear and within the method body 40 00:04:52,400 --> 00:05:01,070 we have today statement said Dot model equal to model self don't bland equal to Brand said data or equal 41 00:05:01,070 --> 00:05:01,670 to. 42 00:05:01,790 --> 00:05:09,820 Or does it self but amateur here mean and what are these three assignment statements. 43 00:05:09,940 --> 00:05:20,260 It is a convention and Biden to name the first parameter of a meter as self and this parameter save 44 00:05:20,680 --> 00:05:31,270 is a reference to the current instance of the class so self refers to the object that is being currently 45 00:05:31,300 --> 00:05:42,820 created so in other class methods it refers to the instance whose method was called and descent. 46 00:05:42,860 --> 00:05:52,070 But amateur lets us access all the instant variables for that specific instance. 47 00:05:52,120 --> 00:05:58,110 So what does this assignment statement mean self dirt model. 48 00:05:58,300 --> 00:05:59,770 Equal to modern 49 00:06:02,300 --> 00:06:07,330 debatable self-taught model is an instance variable. 50 00:06:07,460 --> 00:06:18,560 It is completely different from this variable model and this variable model is passed into the init 51 00:06:18,560 --> 00:06:21,770 method as an argument. 52 00:06:21,800 --> 00:06:36,200 So the model here refers to the parameter in the inert method and self doubt model is the instance variable. 53 00:06:36,470 --> 00:06:51,450 So for example we have created the instant c v by passing arguments like the model and in the brand 54 00:06:53,100 --> 00:06:57,680 and you put out understanding. 55 00:06:57,680 --> 00:07:02,960 This means c v dot Morgan 56 00:07:06,010 --> 00:07:17,720 is 0 0 1 and this argument has been parsed through the input method which gets called automatically 57 00:07:17,990 --> 00:07:33,700 when we create an object similarly the second instance vegetable brand so which is C I'd be brand is 58 00:07:34,210 --> 00:07:35,000 Honda. 59 00:07:35,170 --> 00:07:44,530 Then we create another object say for example Corona the new object is Corona. 60 00:07:44,530 --> 00:07:57,700 This assignment statement would be equal and to Corolla DOD modern is equal to 0 0 2 and then Corolla 61 00:07:57,820 --> 00:07:59,310 Dot brand 62 00:08:01,950 --> 00:08:15,270 is Toyota if we want to access instant vitamin within the class from any of these functions are any 63 00:08:15,330 --> 00:08:18,140 of the methods we use. 64 00:08:18,330 --> 00:08:29,640 This notation said that modern self DOD brand Soviet prefix the self but I'm a dead before the after 65 00:08:30,140 --> 00:08:42,350 separated with the dot operator outside the glass definition if we want to access any all the instance 66 00:08:42,440 --> 00:08:51,290 attribute we can access them using the the name of the object or the name of the instance. 67 00:08:51,320 --> 00:09:02,540 So for example if we want to access the instance attribute model that gives you can access using the 68 00:09:02,630 --> 00:09:11,950 object name of the instance name and then separating the attribute name with the intent name using a 69 00:09:11,950 --> 00:09:21,850 dot operator outside the class definition you'll use the object of the instance name within the class 70 00:09:21,850 --> 00:09:33,410 function you use the self but amateur so we have just seen how instance attributes can be called from 71 00:09:33,560 --> 00:09:41,930 within the class definition and outside the class no let us see how we can call methods that are defined 72 00:09:42,080 --> 00:09:45,650 in the class using the instances that are created. 73 00:09:46,430 --> 00:09:58,950 So here to have defined an object crawler so outside the class definition if we want to call a midterm 74 00:09:59,550 --> 00:10:03,540 this is how we do object dot method name. 75 00:10:03,720 --> 00:10:10,670 So controller dot start engine and then bid entities. 76 00:10:10,850 --> 00:10:15,630 So this is how we call it access methods in the class. 77 00:10:15,710 --> 00:10:24,380 If you notice the method definition has a set of but amateur but indeed. 78 00:10:24,390 --> 00:10:25,460 Method call. 79 00:10:25,500 --> 00:10:30,960 We haven't parsed any parameters but it did work. 80 00:10:31,700 --> 00:10:41,110 This is because whenever it an object cause it method the object itself is biased as the first argument. 81 00:10:41,870 --> 00:10:49,040 So the first argument in this method call would be the object itself. 82 00:10:49,100 --> 00:10:58,350 That is all followed by any argument that we bus in the method 83 00:11:10,410 --> 00:11:13,450 but not 84 00:11:24,940 --> 00:11:26,990 work. 85 00:11:27,940 --> 00:11:33,260 Yep yep yep 86 00:11:36,750 --> 00:11:37,490 yep yep. 87 00:11:54,420 --> 00:11:54,640 More 88 00:11:59,980 --> 00:12:03,030 adapted. 89 00:12:10,010 --> 00:12:11,010 I think 90 00:12:13,960 --> 00:12:36,260 that. 91 00:12:36,430 --> 00:12:50,690 Ya ya ya ya ya ya ya ya ya ya. 92 00:12:50,990 --> 00:13:10,280 Yep yep yep yep yep yep yep yep yep yep yep yep yep yep yep yep yep yep yep yep yep yep 93 00:13:13,940 --> 00:13:14,120 yep 94 00:13:17,070 --> 00:13:17,280 yep 95 00:13:23,400 --> 00:13:31,300 yep yep yep yep yep. 96 00:13:33,070 --> 00:13:35,230 Donald. 97 00:13:35,610 --> 00:13:39,520 Yeah. 98 00:13:41,490 --> 00:13:44,700 Back to 99 00:13:50,060 --> 00:14:02,590 ya ya ya ya ya ya ya ya ya ya ya 100 00:14:06,150 --> 00:14:19,430 ya ya ya ya ya ya ya ya ya ya ya ya spectacle 101 00:14:32,650 --> 00:14:32,820 ya 102 00:14:38,710 --> 00:14:47,470 ah ah ah ah ah ah ah ah ah ah well 103 00:14:50,360 --> 00:14:52,610 it's going to be a military 104 00:14:59,450 --> 00:15:14,230 so da da da da da da da da da da da. 105 00:15:14,330 --> 00:15:23,420 Yep yep yep yep yep yep yep yep yep yep yep yep 106 00:15:26,560 --> 00:15:30,450 yep yep yep yep yep 107 00:15:37,500 --> 00:15:42,140 Gotcha. 108 00:15:45,190 --> 00:15:48,880 But forget about 109 00:15:54,940 --> 00:15:57,820 ah ah ah 110 00:16:05,380 --> 00:16:07,210 ah ah ah 111 00:16:11,110 --> 00:16:13,750 ah ah ah ah ah 112 00:16:17,950 --> 00:16:22,300 ah ah ah ah ah ah ah 113 00:16:26,530 --> 00:16:43,630 ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah 114 00:16:47,020 --> 00:16:49,150 ah ah ah 115 00:16:53,740 --> 00:17:16,090 ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah 116 00:17:21,540 --> 00:17:29,710 ah ah ah ah ah that's 117 00:17:41,530 --> 00:17:42,540 get me 118 00:17:49,010 --> 00:17:49,230 ah 119 00:17:53,880 --> 00:17:53,970 yeah 120 00:17:57,000 --> 00:18:01,330 let me get back 121 00:18:11,770 --> 00:18:11,900 like 122 00:18:15,630 --> 00:18:16,090 typical 123 00:18:27,650 --> 00:18:27,920 ya 124 00:18:31,820 --> 00:18:43,930 ya ya ya ya ya ya ya ya ya ya 125 00:18:50,630 --> 00:18:58,220 ya ya ya ya ya ya ya ya ya ya 126 00:19:01,700 --> 00:19:08,450 ya ya ya ya ya ya ya ya ya 127 00:19:14,710 --> 00:19:14,860 ya 128 00:19:36,230 --> 00:19:41,550 ya BUYING ME DON'T LET 129 00:19:44,490 --> 00:19:46,820 ME GO 130 00:19:53,530 --> 00:20:03,690 YO YO YO YO YO just to be able to 131 00:20:08,270 --> 00:20:08,480 get.