WEBVTT 1 00:00:01.470 --> 00:00:03.360 alright so we finished up in the 2 00:00:03.360 --> 00:00:05.910 previous video talking about how the alright so we finished up in the 3 00:00:05.910 --> 00:00:07.920 intellij refactoring didn't quite previous video talking about how the 4 00:00:07.920 --> 00:00:09.810 work when it came to some of these intellij refactoring didn't quite 5 00:00:09.810 --> 00:00:12.900 replacement fields and it would be quite work when it came to some of these 6 00:00:12.900 --> 00:00:15.300 a bit of work to do this manually to replacement fields and it would be quite 7 00:00:15.300 --> 00:00:18.119 make these changes point here was that a bit of work to do this manually to 8 00:00:18.119 --> 00:00:20.039 just wanted to draw your attention to a make these changes point here was that 9 00:00:20.039 --> 00:00:22.560 possible pitfall with refactoring data just wanted to draw your attention to a 10 00:00:22.560 --> 00:00:25.829 attributes but also in this video possible pitfall with refactoring data 11 00:00:25.829 --> 00:00:26.789 we're going to show you a quick way of attributes but also in this video 12 00:00:26.789 --> 00:00:28.980 dealing with them all the important we're going to show you a quick way of 13 00:00:28.980 --> 00:00:30.659 thing here is that you can get problems dealing with them all the important 14 00:00:30.659 --> 00:00:32.040 if you use this form of replacement thing here is that you can get problems 15 00:00:32.040 --> 00:00:33.300 fields and then try to refactor the if you use this form of replacement 16 00:00:33.300 --> 00:00:35.910 attributes later okay so we've used fields and then try to refactor the 17 00:00:35.910 --> 00:00:38.370 regular expressions in IntelliJ once attributes later okay so we've used 18 00:00:38.370 --> 00:00:41.040 before and their incredibly regular expressions in IntelliJ once 19 00:00:41.040 --> 00:00:43.140 powerful and we'll be looking at them before and their incredibly 20 00:00:43.140 --> 00:00:46.200 at using them in python code later powerful and we'll be looking at them 21 00:00:46.200 --> 00:00:48.420 in the course for now just follow along at using them in python code later 22 00:00:48.420 --> 00:00:50.670 and will sort out these incorrect in the course for now just follow along 23 00:00:50.670 --> 00:00:51.990 attribute names and will sort out these incorrect 24 00:00:51.990 --> 00:00:53.550 we're going to get intellij attribute names 25 00:00:53.550 --> 00:00:56.670 to do a search and replace and we can do that we're going to get intellij 26 00:00:56.670 --> 00:00:58.770 by pressing command on a Mac which I'm to do a search and replace and we can do that 27 00:00:58.770 --> 00:01:01.860 going to do or control r on a pc and if by pressing command on a Mac which I'm 28 00:01:01.860 --> 00:01:03.900 you need to it's the Edit menu find and going to do or control r on a pc and if 29 00:01:03.900 --> 00:01:08.520 replace find replace what i'm going to do you need to it's the Edit menu find and 30 00:01:08.520 --> 00:01:12.780 an alt r this little window pops up replace find replace what i'm going to do 31 00:01:12.780 --> 00:01:15.810 they want to make sure that this reg ex an alt r this little window pops up 32 00:01:15.810 --> 00:01:17.700 is actually ticked regular they want to make sure that this reg ex 33 00:01:17.700 --> 00:01:20.130 expressions box in the top field we want is actually ticked regular 34 00:01:20.130 --> 00:01:23.250 to type left parenthesis we want to put expressions box in the top field we want 35 00:01:23.250 --> 00:01:29.520 a... to type left parenthesis we want to put 36 00:01:29.520 --> 00:01:32.460 ... a... 37 00:01:32.460 --> 00:01:34.890 ...and you can see ... 38 00:01:34.890 --> 00:01:37.080 as soon as I finish the first one it ...and you can see 39 00:01:37.080 --> 00:01:38.159 actually came up and matched a as soon as I finish the first one it 40 00:01:38.159 --> 00:01:40.290 particular field there for us so we want actually came up and matched a 41 00:01:40.290 --> 00:01:42.360 to replace that we just need to type... particular field there for us so we want 42 00:01:42.360 --> 00:01:47.130 so both the curly to replace that we just need to type... 43 00:01:47.130 --> 00:01:49.110 brace and the full stop in that first so both the curly 44 00:01:49.110 --> 00:01:51.270 field are typed in have special meaning brace and the full stop in that first 45 00:01:51.270 --> 00:01:53.400 in regular expressions and field are typed in have special meaning 46 00:01:53.400 --> 00:01:54.479 that's why we having to use the in regular expressions and 47 00:01:54.479 --> 00:01:57.570 backslash to escape them the backslash d that's why we having to use the 48 00:01:57.570 --> 00:02:00.330 matches any digit and again you can see backslash to escape them the backslash d 49 00:02:00.330 --> 00:02:02.280 that the occurrences are now showing up matches any digit and again you can see 50 00:02:02.280 --> 00:02:03.930 now that I've actually into that in this that the occurrences are now showing up 51 00:02:03.930 --> 00:02:06.270 class obviously i needed to be an enemy now that I've actually into that in this 52 00:02:06.270 --> 00:02:08.700 .py before I started this and for the class obviously i needed to be an enemy 53 00:02:08.700 --> 00:02:11.069 replacement in the second field and we .py before I started this and for the 54 00:02:11.069 --> 00:02:12.930 just need to put the dollar sign one_ replacement in the second field and we 55 00:02:12.930 --> 00:02:13.400 just need to put the dollar sign one_ 56 00:02:13.400 --> 00:02:16.400 now hear that dollar one means or 57 00:02:16.400 --> 00:02:18.829 specifies anything that was matched now hear that dollar one means or 58 00:02:18.829 --> 00:02:20.870 inside the parentheses in the search box specifies anything that was matched 59 00:02:20.870 --> 00:02:23.450 so when all set and done what we're doing inside the parentheses in the search box 60 00:02:23.450 --> 00:02:25.220 is just adding an _ after the so when all set and done what we're doing 61 00:02:25.220 --> 00:02:26.239 full stop is just adding an _ after the 62 00:02:26.239 --> 00:02:29.659 then click on replace all and that takes full stop 63 00:02:29.659 --> 00:02:32.359 care of all the replacement fields if then click on replace all and that takes 64 00:02:32.359 --> 00:02:33.590 you happen to have made a mistake there care of all the replacement fields if 65 00:02:33.590 --> 00:02:35.359 you can do a control z on a pc you happen to have made a mistake there 66 00:02:35.359 --> 00:02:37.489 commands z on a mac or come up to you can do a control z on a pc 67 00:02:37.489 --> 00:02:39.829 and then undo and then try again so commands z on a mac or come up to 68 00:02:39.829 --> 00:02:41.299 you can't really go wrong it will just and then undo and then try again so 69 00:02:41.299 --> 00:02:43.129 undo those last changes for you you can't really go wrong it will just 70 00:02:43.129 --> 00:02:45.260 so now that I've done that I can close undo those last changes for you 71 00:02:45.260 --> 00:02:46.370 down this window so now that I've done that I can close 72 00:02:46.370 --> 00:02:49.670 go back to main and should now run for down this window 73 00:02:49.670 --> 00:02:52.489 us you can see it's now running again go back to main and should now run for 74 00:02:52.489 --> 00:02:54.709 properly so it wasn't the end of the us you can see it's now running again 75 00:02:54.709 --> 00:02:56.569 world but it can be a bit scary when properly so it wasn't the end of the 76 00:02:56.569 --> 00:02:58.909 you factor things with IntelliJ and world but it can be a bit scary when 77 00:02:58.909 --> 00:03:01.609 your code suddenly breaks as this is a you factor things with IntelliJ and 78 00:03:01.609 --> 00:03:03.709 common reason for refactoring data your code suddenly breaks as this is a 79 00:03:03.709 --> 00:03:05.840 attributes in your classes and that's common reason for refactoring data 80 00:03:05.840 --> 00:03:07.430 this form of the replacement field is so attributes in your classes and that's 81 00:03:07.430 --> 00:03:09.590 useful i thought i'd show you what can this form of the replacement field is so 82 00:03:09.590 --> 00:03:10.970 but what can actually go wrong and useful i thought i'd show you what can 83 00:03:10.970 --> 00:03:12.769 possibly save you some grief in the future but what can actually go wrong and 84 00:03:12.769 --> 00:03:14.329 if that happens to you possibly save you some grief in the future 85 00:03:14.329 --> 00:03:16.700 of course if would use the _ to if that happens to you 86 00:03:16.700 --> 00:03:18.530 start with we wouldn't have had a problem of course if would use the _ to 87 00:03:18.530 --> 00:03:19.160 at all start with we wouldn't have had a problem 88 00:03:19.160 --> 00:03:21.709 now we can still change the values and at all 89 00:03:21.709 --> 00:03:24.049 our program still does because this is now we can still change the values and 90 00:03:24.049 --> 00:03:26.690 python and nothing is truly private but our program still does because this is 91 00:03:26.690 --> 00:03:29.090 there's now an indication that we should python and nothing is truly private but 92 00:03:29.090 --> 00:03:30.709 really be changing those attributes there's now an indication that we should 93 00:03:30.709 --> 00:03:32.090 directly really be changing those attributes 94 00:03:32.090 --> 00:03:41.610 let's move over now to a challenge directly 95 00:03:41.610 --> 00:03:43.590 so to help consolidate your let's move over now to a challenge 96 00:03:43.590 --> 00:03:45.750 understanding of inheritance got a so to help consolidate your 97 00:03:45.750 --> 00:03:48.090 challenge for you to try out so the understanding of inheritance got a 98 00:03:48.090 --> 00:03:50.700 challenge is to try and create a vampire King challenge for you to try out so the 99 00:03:50.700 --> 00:03:54.510 subclass of vampire now a vampire king challenge is to try and create a vampire King 100 00:03:54.510 --> 00:03:56.820 is going to be incredibly powerful and subclass of vampire now a vampire king 101 00:03:56.820 --> 00:03:58.650 any points of damage inflicted will be is going to be incredibly powerful and 102 00:03:58.650 --> 00:04:02.010 divided by four vampire King objects any points of damage inflicted will be 103 00:04:02.010 --> 00:04:07.730 will also start off with 140 hit points divided by four vampire King objects 104 00:04:07.730 --> 00:04:11.060 so extend the vampire class to create a will also start off with 140 hit points 105 00:04:11.060 --> 00:04:13.250 new vampire King class with those so extend the vampire class to create a 106 00:04:13.250 --> 00:04:15.620 additional properties then you want to new vampire King class with those 107 00:04:15.620 --> 00:04:18.169 test the new class by creating a new additional properties then you want to 108 00:04:18.169 --> 00:04:20.299 vampire King object and checking that it test the new class by creating a new 109 00:04:20.299 --> 00:04:21.410 does start with a hundred and vampire King object and checking that it 110 00:04:21.410 --> 00:04:23.060 forty hit points and only takes a does start with a hundred and 111 00:04:23.060 --> 00:04:26.120 quarter of any damage inflicted alright forty hit points and only takes a 112 00:04:26.120 --> 00:04:27.830 so pause the video here and try that out quarter of any damage inflicted alright 113 00:04:27.830 --> 00:04:31.490 and i'll see you when you get back so pause the video here and try that out 114 00:04:31.490 --> 00:04:34.550 ok so how did you come up with that one and i'll see you when you get back 115 00:04:34.550 --> 00:04:36.139 let's go through now and come up with a ok so how did you come up with that one 116 00:04:36.139 --> 00:04:38.210 solution for this we're going to start let's go through now and come up with a 117 00:04:38.210 --> 00:04:43.520 by creating the new class i'm solution for this we're going to start 118 00:04:43.520 --> 00:04:45.199 going to create that just below the by creating the new class i'm 119 00:04:45.199 --> 00:04:50.810 vampire class is going to be class... going to create that just below the 120 00:04:50.810 --> 00:04:56.660 .... vampire class is going to be class... 121 00:04:56.660 --> 00:04:58.729 ... .... 122 00:04:58.729 --> 00:05:03.470 ... ... 123 00:05:03.470 --> 00:05:06.530 .... ... 124 00:05:06.530 --> 00:05:11.000 ... .... 125 00:05:11.000 --> 00:05:18.260 ... ... 126 00:05:18.260 --> 00:05:23.419 ...now this constructor will ... 127 00:05:23.419 --> 00:05:25.970 ...create a new object that is exactly the same as a ...now this constructor will 128 00:05:25.970 --> 00:05:28.460 an ordinary vampire so we do need to set ...create a new object that is exactly the same as a 129 00:05:28.460 --> 00:05:31.010 the hit point value after calling an ordinary vampire so we do need to set 130 00:05:31.010 --> 00:05:34.160 this init method on line 60 let's go the hit point value after calling 131 00:05:34.160 --> 00:05:35.570 ahead and do that so it's gonna be self this init method on line 60 let's go 132 00:05:35.570 --> 00:05:38.870 .... ahead and do that so it's gonna be self 133 00:05:38.870 --> 00:05:41.570 ...so that's our .... 134 00:05:41.570 --> 00:05:43.789 constructor done we're going to test ...so that's our 135 00:05:43.789 --> 00:05:45.620 that in a moment but notice the single constructor done we're going to test 136 00:05:45.620 --> 00:05:47.840 parameter we use when calling the that in a moment but notice the single 137 00:05:47.840 --> 00:05:51.050 super init method on line 60 now our parameter we use when calling the 138 00:05:51.050 --> 00:05:54.080 vampire class is a subclass of enemy and super init method on line 60 now our 139 00:05:54.080 --> 00:05:57.410 vampire king is a subclass of vampire so vampire class is a subclass of enemy and 140 00:05:57.410 --> 00:05:59.270 the method that will be called when we use vampire king is a subclass of vampire so 141 00:05:59.270 --> 00:06:01.970 super init here is actually the the method that will be called when we use 142 00:06:01.970 --> 00:06:04.490 vampire class init method and not the super init here is actually the 143 00:06:04.490 --> 00:06:07.880 enemy init method now the init method in vampire class init method and not the 144 00:06:07.880 --> 00:06:10.250 the vampire class will then call init enemy init method now the init method in 145 00:06:10.250 --> 00:06:13.039 in the enemy class so the calls will pass the vampire class will then call init 146 00:06:13.039 --> 00:06:15.260 up the chain with each sub class in the enemy class so the calls will pass 147 00:06:15.260 --> 00:06:17.000 calling the init method of its up the chain with each sub class 148 00:06:17.000 --> 00:06:19.610 superclass ok so next we need to calling the init method of its 149 00:06:19.610 --> 00:06:21.360 override the take damage method superclass ok so next we need to 150 00:06:21.360 --> 00:06:23.460 so that the damage is divided by override the take damage method 151 00:06:23.460 --> 00:06:25.979 four so let's create the damage so that the damage is divided by 152 00:06:25.979 --> 00:06:29.129 methods so def.... four so let's create the damage 153 00:06:29.129 --> 00:06:32.189 ... methods so def.... 154 00:06:32.189 --> 00:06:38.969 ... ... 155 00:06:38.969 --> 00:06:41.610 ...so we are now dividing ... 156 00:06:41.610 --> 00:06:42.930 the damaged by 4 when we call that ...so we are now dividing 157 00:06:42.930 --> 00:06:45.629 super method and used integer the damaged by 4 when we call that 158 00:06:45.629 --> 00:06:47.669 division here because we don't super method and used integer 159 00:06:47.669 --> 00:06:49.469 want to be subtracting fractional values division here because we don't 160 00:06:49.469 --> 00:06:51.509 from the hit points so if we try to want to be subtracting fractional values 161 00:06:51.509 --> 00:06:53.819 inflict nine points of damage our vampire from the hit points so if we try to 162 00:06:53.819 --> 00:06:55.949 king will only take two points that's inflict nine points of damage our vampire 163 00:06:55.949 --> 00:06:57.389 because integer division king will only take two points that's 164 00:06:57.389 --> 00:06:58.949 actually rounds down because integer division 165 00:06:58.949 --> 00:07:00.870 alright so what about the ability to actually rounds down 166 00:07:00.870 --> 00:07:03.240 dodge well its important to understand alright so what about the ability to 167 00:07:03.240 --> 00:07:06.120 exactly which class is the superclass dodge well its important to understand 168 00:07:06.120 --> 00:07:09.900 here now vampire King extends vampire so exactly which class is the superclass 169 00:07:09.900 --> 00:07:12.029 the super method we are calling is the here now vampire King extends vampire so 170 00:07:12.029 --> 00:07:14.789 vampire method and not the enemy method the super method we are calling is the 171 00:07:14.789 --> 00:07:18.150 so what happens is that the vampire King vampire method and not the enemy method 172 00:07:18.150 --> 00:07:21.120 take_damage method calls the so what happens is that the vampire King 173 00:07:21.120 --> 00:07:23.610 method in its superclass which is vampire take_damage method calls the 174 00:07:23.610 --> 00:07:26.099 the vampire class take_damage method in its superclass which is vampire 175 00:07:26.099 --> 00:07:27.900 method then calls its superclass the vampire class take_damage 176 00:07:27.900 --> 00:07:30.930 method so it calls the enemy take_damage method then calls its superclass 177 00:07:30.930 --> 00:07:33.270 method now intelliJ has a method so it calls the enemy take_damage 178 00:07:33.270 --> 00:07:35.460 really useful feature to help understand method now intelliJ has a 179 00:07:35.460 --> 00:07:37.860 all of this back in the vampire King really useful feature to help understand 180 00:07:37.860 --> 00:07:41.190 class i can hold down ctrl or command all of this back in the vampire King 181 00:07:41.190 --> 00:07:43.409 depending on your operating system and class i can hold down ctrl or command 182 00:07:43.409 --> 00:07:45.479 click on the word take damage in the depending on your operating system and 183 00:07:45.479 --> 00:07:47.279 super . take damage method down here click on the word take damage in the 184 00:07:47.279 --> 00:07:51.180 and actually click on that now notice super . take damage method down here 185 00:07:51.180 --> 00:07:52.620 that the cursor has taken me to the and actually click on that now notice 186 00:07:52.620 --> 00:07:54.719 take_damage method from the that the cursor has taken me to the 187 00:07:54.719 --> 00:07:57.509 vampire class if i do that again now take_damage method from the 188 00:07:57.509 --> 00:07:59.370 coming over here to the take damage vampire class if i do that again now 189 00:07:59.370 --> 00:08:00.900 that's now in the vampire class click on coming over here to the take damage 190 00:08:00.900 --> 00:08:03.750 it's now moved up the cursor to the that's now in the vampire class click on 191 00:08:03.750 --> 00:08:05.789 take_damage method which is it's now moved up the cursor to the 192 00:08:05.789 --> 00:08:09.089 now in the enemy class again ctrl or take_damage method which is 193 00:08:09.089 --> 00:08:12.389 command is the key you click along with now in the enemy class again ctrl or 194 00:08:12.389 --> 00:08:15.210 the actual method to get that to command is the key you click along with 195 00:08:15.210 --> 00:08:17.879 work on your operating system so the actual method to get that to 196 00:08:17.879 --> 00:08:19.620 basically you can follow the trail back work on your operating system so 197 00:08:19.620 --> 00:08:22.319 which is great for checking exactly what basically you can follow the trail back 198 00:08:22.319 --> 00:08:24.479 those overwritten methods are doing which is great for checking exactly what 199 00:08:24.479 --> 00:08:27.389 alright so that's it let's now see if it those overwritten methods are doing 200 00:08:27.389 --> 00:08:30.810 works and go back to our main py file alright so that's it let's now see if it 201 00:08:30.810 --> 00:08:33.449 and we're going to comment out the code works and go back to our main py file 202 00:08:33.449 --> 00:08:34.800 in the main program and we're going to comment out the code 203 00:08:34.800 --> 00:08:41.550 do that completely and leave it down the bottom in the main program 204 00:08:41.550 --> 00:08:43.589 instead code at the top here and what do that completely and leave it down the bottom 205 00:08:43.589 --> 00:08:44.519 we're going to do is create a new instead code at the top here and what 206 00:08:44.519 --> 00:08:46.860 vampire King class called Dracula we're going to do is create a new 207 00:08:46.860 --> 00:08:54.240 Dracula... vampire King class called Dracula 208 00:08:54.240 --> 00:08:55.890 thing we need to do because the moment Dracula... 209 00:08:55.890 --> 00:08:57.870 you can see the vampire is there we haven't thing we need to do because the moment 210 00:08:57.870 --> 00:09:00.000 imported this class new class we need to you can see the vampire is there we haven't 211 00:09:00.000 --> 00:09:02.880 import vampire King like so and come back imported this class new class we need to 212 00:09:02.880 --> 00:09:04.890 here and specify that's the vampire King import vampire King like so and come back 213 00:09:04.890 --> 00:09:07.110 class and we're going to call him here and specify that's the vampire King 214 00:09:07.110 --> 00:09:10.920 Dracula....so lets write it out to print him first to class and we're going to call him 215 00:09:10.920 --> 00:09:12.540 make sure that the initial values are Dracula....so lets write it out to print him first to 216 00:09:12.540 --> 00:09:15.930 said and he has got 240 points right then make sure that the initial values are 217 00:09:15.930 --> 00:09:20.279 Dracula starters take damage... said and he has got 240 points right then 218 00:09:20.279 --> 00:09:21.870 that damage will be divided by 4 Dracula starters take damage... 219 00:09:21.870 --> 00:09:23.070 so we should only get three points of that damage will be divided by 4 220 00:09:23.070 --> 00:09:27.899 damage.... so we should only get three points of 221 00:09:27.899 --> 00:09:31.019 and see that it works so you can damage.... 222 00:09:31.019 --> 00:09:33.990 see that in this case you got started of and see that it works so you can 223 00:09:33.990 --> 00:09:36.720 with 140 points of damage but he actually see that in this case you got started of 224 00:09:36.720 --> 00:09:39.240 dodge successfully and therefore didn't with 140 points of damage but he actually 225 00:09:39.240 --> 00:09:40.470 lose any hit points because I'm dodge successfully and therefore didn't 226 00:09:40.470 --> 00:09:42.420 remembering this only a one chance in lose any hit points because I'm 227 00:09:42.420 --> 00:09:44.010 three the dodgers and avoids all the remembering this only a one chance in 228 00:09:44.010 --> 00:09:45.930 damage in this case he did Dodge three the dodgers and avoids all the 229 00:09:45.930 --> 00:09:49.529 so i need to run this again this time he damage in this case he did Dodge 230 00:09:49.529 --> 00:09:50.820 has managed to take three points of so i need to run this again this time he 231 00:09:50.820 --> 00:09:54.300 damage 12/4 is 3 so he's left we still has managed to take three points of 232 00:09:54.300 --> 00:09:56.579 with three lives and 137 hitpoints damage 12/4 is 3 so he's left we still 233 00:09:56.579 --> 00:09:58.440 alright so that's the challenge with three lives and 137 hitpoints 234 00:09:58.440 --> 00:10:01.079 completed now your solution may well be alright so that's the challenge 235 00:10:01.079 --> 00:10:02.820 different to mine and is always that's completed now your solution may well be 236 00:10:02.820 --> 00:10:03.510 fine different to mine and is always that's 237 00:10:03.510 --> 00:10:05.790 the important thing is that it works not fine 238 00:10:05.790 --> 00:10:07.290 that it looks exactly the same as have the important thing is that it works not 239 00:10:07.290 --> 00:10:09.600 done here it's often said that if you that it looks exactly the same as have 240 00:10:09.600 --> 00:10:11.070 ask 10 programmers to solve a problem done here it's often said that if you 241 00:10:11.070 --> 00:10:13.290 you'll get in 11 different solutions ask 10 programmers to solve a problem 242 00:10:13.290 --> 00:10:15.600 so there's very very rarely only one way you'll get in 11 different solutions 243 00:10:15.600 --> 00:10:17.940 to write code so the main thing is if so there's very very rarely only one way 244 00:10:17.940 --> 00:10:20.010 your code solution works then to write code so the main thing is if 245 00:10:20.010 --> 00:10:21.180 congratulations your code solution works then 246 00:10:21.180 --> 00:10:22.740 alright so hopefully that's now congratulations 247 00:10:22.740 --> 00:10:24.990 consolidated your understanding of alright so hopefully that's now 248 00:10:24.990 --> 00:10:27.420 subclassing and how classes can inherit consolidated your understanding of 249 00:10:27.420 --> 00:10:30.540 from the superclass and in turn how they subclassing and how classes can inherit 250 00:10:30.540 --> 00:10:32.640 can also be the superclass of another from the superclass and in turn how they 251 00:10:32.640 --> 00:10:34.440 class that extends them further can also be the superclass of another 252 00:10:34.440 --> 00:10:37.290 inheritance can be a very useful feature class that extends them further 253 00:10:37.290 --> 00:10:39.600 but maybe because it's so often taught inheritance can be a very useful feature 254 00:10:39.600 --> 00:10:41.040 right at the start of course is an but maybe because it's so often taught 255 00:10:41.040 --> 00:10:43.079 object-oriented programming many right at the start of course is an 256 00:10:43.079 --> 00:10:44.730 programmers feel they have to use object-oriented programming many 257 00:10:44.730 --> 00:10:46.770 inheritance they go out of their way to programmers feel they have to use 258 00:10:46.770 --> 00:10:48.390 look for ways that they can sub inheritance they go out of their way to 259 00:10:48.390 --> 00:10:50.010 class something to produce look for ways that they can sub 260 00:10:50.010 --> 00:10:52.110 something else they need and that's class something to produce 261 00:10:52.110 --> 00:10:54.240 often not a helpful approach especially something else they need and that's 262 00:10:54.240 --> 00:10:57.390 in a language like Python in python if often not a helpful approach especially 263 00:10:57.390 --> 00:10:59.220 there's a need to use inheritance then it really in a language like Python in python if 264 00:10:59.220 --> 00:11:01.770 should jump out at you you you wouldn't there's a need to use inheritance then it really 265 00:11:01.770 --> 00:11:04.050 really have to go looking for it now all should jump out at you you you wouldn't 266 00:11:04.050 --> 00:11:05.790 our enemies were enemies they really did really have to go looking for it now all 267 00:11:05.790 --> 00:11:07.920 share common traits and we intended to our enemies were enemies they really did 268 00:11:07.920 --> 00:11:09.990 use the more all of them in a similar way as share common traits and we intended to 269 00:11:09.990 --> 00:11:11.940 things to bash in vent our frustration use the more all of them in a similar way as 270 00:11:11.940 --> 00:11:13.680 so the inheritance relationship things to bash in vent our frustration 271 00:11:13.680 --> 00:11:16.350 we created in the last few videos were so the inheritance relationship 272 00:11:16.350 --> 00:11:18.600 probably a good way to create the troll we created in the last few videos were 273 00:11:18.600 --> 00:11:22.110 the vampire the vampire King classes now probably a good way to create the troll 274 00:11:22.110 --> 00:11:23.490 python relies heavily on an the vampire the vampire King classes now 275 00:11:23.490 --> 00:11:24.990 object-oriented feature called python relies heavily on an 276 00:11:24.990 --> 00:11:27.120 polymorphism i'm going to have a look at object-oriented feature called 277 00:11:27.120 --> 00:11:29.280 that in the next video and find out what polymorphism i'm going to have a look at 278 00:11:29.280 --> 00:11:31.080 people mean when they say if it quacks that in the next video and find out what 279 00:11:31.080 --> 00:11:32.040 like a duck people mean when they say if it quacks 280 00:11:32.040 --> 00:11:38.390 so see you in the next video like a duck