1
00:00:01,700 --> 00:00:02,370
Hello everyone.

2
00:00:02,400 --> 00:00:05,780
So till now we have discussed in detail about inheritance.

3
00:00:05,810 --> 00:00:07,640
I hope that part is now clear.

4
00:00:07,640 --> 00:00:11,150
Now in this video I want to discuss next topic of Opes.

5
00:00:11,170 --> 00:00:17,900
Note This polymorphism so polymorphism means many forms okay.

6
00:00:18,000 --> 00:00:24,930
So in terms of code we can see polymorphism means there a set of code behave differently in different

7
00:00:24,930 --> 00:00:25,800
situation.

8
00:00:25,800 --> 00:00:26,230
Okay.

9
00:00:26,310 --> 00:00:28,320
So there are two types of polymorphism.

10
00:00:28,320 --> 00:00:33,870
So first one is the compiler that polymorphism and the second one is runtime polymorphism.

11
00:00:33,870 --> 00:00:40,080
So compile time polymorphism means how a set of code will behave outside of court will behave will we

12
00:00:40,080 --> 00:00:46,980
decided at the compile time Okay and then type one on one with him how the set of code will behave will

13
00:00:46,980 --> 00:00:50,550
be decided at the current time okay.

14
00:00:50,580 --> 00:00:57,020
So in this we do our focus is on compile time polymorphism and the next we deal we will cover in time

15
00:00:57,030 --> 00:00:58,970
polymorphism as well okay.

16
00:00:59,070 --> 00:01:05,090
So compile time polymorphism to compile time polymorphism can be achieved using movies.

17
00:01:05,100 --> 00:01:12,310
So the first way to achieve compile them polymorphism is function overloading which we have already

18
00:01:12,310 --> 00:01:13,260
started.

19
00:01:13,360 --> 00:01:20,050
And the second way to achieve compile time polymorphism is operator overloading which we have also started

20
00:01:20,170 --> 00:01:22,280
in OBS in details.

21
00:01:22,450 --> 00:01:25,970
Okay so what is the meaning of function overloading.

22
00:01:26,020 --> 00:01:30,890
So it means that different functions with the same name but destructor will be different.

23
00:01:31,720 --> 00:01:35,820
Okay so we will have many functions we will have many functions.

24
00:01:35,980 --> 00:01:39,330
Those function will have the same name but destructor will be different.

25
00:01:39,340 --> 00:01:41,580
Okay so let's see in code.

26
00:01:41,650 --> 00:01:41,950
Okay.

27
00:01:46,120 --> 00:01:53,860
So I have this called so as we can see here we have many functions with the same name based function

28
00:01:53,860 --> 00:01:59,320
test function test function all the three functions have the same name but then the modified arguments

29
00:01:59,320 --> 00:02:00,140
are different.

30
00:02:00,160 --> 00:02:07,410
So if I will call best then it will call this function because a number of 5 arguments are do.

31
00:02:07,860 --> 00:02:16,290
If I will write test 1 then this function will be called okay because of the number of arguments.

32
00:02:16,370 --> 00:02:20,530
So we are deciding at the compile them which function will be called.

33
00:02:20,650 --> 00:02:21,350
Okay.

34
00:02:21,380 --> 00:02:24,350
So we are deciding that the compiler which function will be called.

35
00:02:24,390 --> 00:02:29,300
That's why we can use function overloading to achieve compile time polymorphism.

36
00:02:29,300 --> 00:02:29,900
Okay.

37
00:02:29,960 --> 00:02:32,590
So what will happen if I create one more function.

38
00:02:32,600 --> 00:02:39,080
Suppose I have these three functions and now I am creating one more function by then I will the function

39
00:02:39,080 --> 00:02:43,370
is void and the function name is same as test.

40
00:02:43,430 --> 00:02:50,130
Okay the function name is best and we also have a function in test.

41
00:02:50,360 --> 00:02:55,790
So among these two functions only the return type is different here there than there was in PJ and here

42
00:02:55,790 --> 00:02:58,440
there than diapers void everything the same.

43
00:02:58,460 --> 00:02:58,750
Okay.

44
00:02:58,750 --> 00:03:01,790
Same function name and the number of arguments of 0.

45
00:03:01,820 --> 00:03:02,360
Okay.

46
00:03:02,390 --> 00:03:04,240
We are not receiving any argument.

47
00:03:04,400 --> 00:03:08,840
So one thing that I wondered earlier is we cannot differentiate between these two function with the

48
00:03:08,840 --> 00:03:09,970
help of return type.

49
00:03:09,980 --> 00:03:10,680
Okay.

50
00:03:10,700 --> 00:03:12,950
You don't type with the help of return type.

51
00:03:12,950 --> 00:03:16,020
We cannot differentiate between these two functions.

52
00:03:16,070 --> 00:03:16,550
Okay.

53
00:03:16,670 --> 00:03:23,000
If I will call from the mean test then the compiler will get confused which function to call this one

54
00:03:23,360 --> 00:03:25,250
or this one.

55
00:03:25,250 --> 00:03:27,510
Okay so there will be ambiguity.

56
00:03:27,500 --> 00:03:30,380
The compiler will get confused among these two functions.

57
00:03:30,470 --> 00:03:33,670
So these two functions cannot be created in one file.

58
00:03:34,300 --> 00:03:34,790
Okay.

59
00:03:34,880 --> 00:03:37,340
We cannot differentiate with the help of return type.

60
00:03:37,460 --> 00:03:42,500
If you want to differentiate if you want to differentiate then with the help of function name we can

61
00:03:42,500 --> 00:03:47,330
differentiate with the help of function name the number of arguments and the type of argument but not

62
00:03:47,330 --> 00:03:49,130
with the return type.

63
00:03:49,130 --> 00:03:54,960
Okay now now we have already know where this function overloading.

64
00:03:55,010 --> 00:03:57,480
Now let's see what is operator overloading.

65
00:03:57,530 --> 00:04:04,060
So if you remember we have discussed about operator overloading in detail in section only.

66
00:04:04,130 --> 00:04:04,570
Okay.

67
00:04:04,700 --> 00:04:06,940
So let's take the example of plus operator.

68
00:04:07,010 --> 00:04:10,910
Okay so let's take the example of plus operator.

69
00:04:10,910 --> 00:04:14,650
So when I write two plus three output will be five.

70
00:04:14,660 --> 00:04:17,410
So here plus adds to integer.

71
00:04:17,660 --> 00:04:21,190
When I write three point five plus let's say one point five.

72
00:04:21,240 --> 00:04:23,640
And I would probably be five point zero.

73
00:04:23,700 --> 00:04:32,140
So plus operator add to the doubles here if I write correctly a plus character B then word plus operator

74
00:04:32,150 --> 00:04:37,490
will lower it will convert these two values in goods ask I value so this will be 97 and this will be

75
00:04:37,490 --> 00:04:38,090
98.

76
00:04:38,480 --> 00:04:40,610
So plus add two characters here.

77
00:04:40,610 --> 00:04:45,800
So we have only one operator which is the plus operator and plus operators behaving differently in different

78
00:04:45,800 --> 00:04:46,940
situation.

79
00:04:46,940 --> 00:04:47,490
Okay.

80
00:04:47,540 --> 00:04:52,820
If you remember the complex number class we have overloaded the plus operator for complex number class.

81
00:04:52,820 --> 00:04:58,970
Then if I write seven plus you do then here the plus operator is working differently.

82
00:04:59,220 --> 00:04:59,690
Okay.

83
00:04:59,760 --> 00:05:04,310
So we are deciding at the compile time only that how the operator will work.

84
00:05:04,320 --> 00:05:04,590
Okay.

85
00:05:04,590 --> 00:05:09,000
So with the help of operator overloading we can achieve compile time polymorphism.

86
00:05:09,000 --> 00:05:09,300
Okay.

87
00:05:09,330 --> 00:05:16,010
So I hope these two are very clear how we are achieving compile them but in my wisdom we are deciding

88
00:05:16,010 --> 00:05:19,550
at the compile them only that what a set of code will do.

89
00:05:20,140 --> 00:05:20,810
Okay.

90
00:05:20,810 --> 00:05:22,910
Now there is a third way.

91
00:05:23,130 --> 00:05:29,090
There is a territory also to achieve the compile type polymorphism and it is called Method overwriting

92
00:05:29,150 --> 00:05:30,990
or we can save function overwriting.

93
00:05:31,010 --> 00:05:31,820
Okay.

94
00:05:32,150 --> 00:05:35,630
Matador function overwriting.

95
00:05:35,770 --> 00:05:39,930
Now let us try to understand what is the meaning of function overwriting.

96
00:05:40,030 --> 00:05:40,330
Okay.

97
00:05:42,750 --> 00:05:51,690
Now okay so where does functional writing so let's say I have two classes Class A and Class B B in that

98
00:05:51,690 --> 00:05:53,200
it's class A.

99
00:05:53,440 --> 00:06:00,790
And so is the parent class and being taught based class and b d child that I have to class.

100
00:06:01,660 --> 00:06:05,050
Okay now suppose Class E has a brain function

101
00:06:07,700 --> 00:06:11,350
and we have also created a brain function inside Class B.

102
00:06:11,350 --> 00:06:13,160
We also use brain function of its own.

103
00:06:13,190 --> 00:06:13,970
So what it will have.

104
00:06:14,000 --> 00:06:19,700
So what will happen this brain function will override this brain function.

105
00:06:19,740 --> 00:06:22,580
Okay now let us understand with the help of code.

106
00:06:22,650 --> 00:06:22,860
Okay

107
00:06:26,450 --> 00:06:33,400
so I have this class so I have a class with can and I have a class got so inside the class we call I

108
00:06:33,410 --> 00:06:37,340
have a brain function and inside the car class so called class.

109
00:06:37,340 --> 00:06:43,790
First of all it in that it's from the class and it is and it is also having a brain function.

110
00:06:43,850 --> 00:06:48,290
Okay so what will happen this brain function will override this print function.

111
00:06:48,290 --> 00:06:57,290
Now what I want to convey here is let's say we are creating objects so I am creating object of the class

112
00:06:58,510 --> 00:07:01,740
and let's see I am also creating the object of kind of class.

113
00:07:01,810 --> 00:07:05,260
Okay so what do you with the order of the constructor call.

114
00:07:05,860 --> 00:07:10,990
So we have already discussed about the order of constructor called but let's say let's revise it again.

115
00:07:10,990 --> 00:07:12,050
Let's recap.

116
00:07:12,190 --> 00:07:18,700
So in this case what will happen only DV Could a class constructor will be called and in this case first

117
00:07:18,820 --> 00:07:23,270
the vehicle's less constructor will be called and then the of class constructor will be called.

118
00:07:23,280 --> 00:07:25,810
Okay so what is the structure of working class.

119
00:07:25,810 --> 00:07:35,420
So this is some political class and inside and it and it has print function so this is called class

120
00:07:35,540 --> 00:07:38,240
and it has the class.

121
00:07:38,240 --> 00:07:43,810
It has print function and the Car class also has brain function of its own.

122
00:07:43,850 --> 00:07:49,880
Okay so now if I run this file what will happen first of all the class constructor will be called and

123
00:07:49,880 --> 00:07:55,520
in this case first class and then called class constructor but I have not created any constructor so

124
00:07:55,550 --> 00:07:57,720
we will not be able to see the messages.

125
00:07:57,770 --> 00:07:58,270
Okay.

126
00:07:58,430 --> 00:08:00,920
Now what will happen if I call the print function.

127
00:08:00,920 --> 00:08:09,020
So if I write we don't print and if I write see dark print then what do we think what will happen.

128
00:08:09,020 --> 00:08:14,330
So we already know we don't print it will call the print function of the vehicle class so the output

129
00:08:14,330 --> 00:08:15,270
will be vehicle.

130
00:08:15,380 --> 00:08:20,840
And if I call you Lord print what will happen it will call the print function of the God class.

131
00:08:21,080 --> 00:08:24,700
Okay so the output will be God okay.

132
00:08:24,800 --> 00:08:29,450
So we are deciding at the compile time which function to be called.

133
00:08:29,450 --> 00:08:30,560
Okay.

134
00:08:30,560 --> 00:08:31,660
I am repeating myself.

135
00:08:31,700 --> 00:08:35,000
We are deciding at the compile time or leaders which function will be called.

136
00:08:35,030 --> 00:08:37,480
If we have multiple options available to us.

137
00:08:37,490 --> 00:08:40,630
So in this case I have multiple options available to us.

138
00:08:40,670 --> 00:08:45,380
I have two print functions so I am deciding at the compile them only that this print function would

139
00:08:45,380 --> 00:08:45,880
be called.

140
00:08:45,920 --> 00:08:52,790
Now how I am able to decided to compile them because we can see here this week it belongs to vehicle

141
00:08:52,850 --> 00:08:53,630
object.

142
00:08:53,630 --> 00:08:54,850
This is a vehicle object.

143
00:08:54,920 --> 00:08:59,750
So when I write we document it will call the print function of the vehicle class.

144
00:08:59,750 --> 00:09:01,740
Now here I am writing C document.

145
00:09:01,760 --> 00:09:07,770
Now C is an object of God class so it will call the print function of the God class.

146
00:09:07,850 --> 00:09:10,100
So that's why this print function will be called.

147
00:09:10,160 --> 00:09:14,820
So with the help of type of object we can decide which function will be called.

148
00:09:14,840 --> 00:09:16,540
Okay now let's win this fight.

149
00:09:18,670 --> 00:09:23,530
Okay so first of all let's write we don't print and see Dortmund

150
00:09:29,360 --> 00:09:30,610
no alerts on this file

151
00:09:34,180 --> 00:09:37,120
so the output this vehicle and God.

152
00:09:37,120 --> 00:09:39,150
We don't print and see Dortmund.

153
00:09:39,340 --> 00:09:43,470
Now if the car doesn't have any print function then we will call.

154
00:09:43,920 --> 00:09:44,160
Okay.

155
00:09:44,170 --> 00:09:51,150
So what I want to say here is if I do not have let's see the car plus do not have been functional for

156
00:09:51,190 --> 00:09:54,450
John so we know what will happen.

157
00:09:56,240 --> 00:10:01,260
So if the car doesn't have brain function of its own then we will call the print function of the vehicle

158
00:10:01,380 --> 00:10:02,190
class.

159
00:10:02,390 --> 00:10:02,690
Okay.

160
00:10:02,690 --> 00:10:06,200
And if because class doesn't have brain function also then it will throw it in.

161
00:10:06,230 --> 00:10:07,870
Okay so this land throws at it.

162
00:10:07,940 --> 00:10:10,340
If the vehicle doesn't have print function.

163
00:10:10,400 --> 00:10:13,640
Okay now let's take one more example.

164
00:10:13,700 --> 00:10:14,290
Okay.

165
00:10:14,300 --> 00:10:17,270
Now here we are creating the objects statically.

166
00:10:17,300 --> 00:10:19,940
Now what will happen if I create the object manually.

167
00:10:19,970 --> 00:10:28,190
So we could start we let's say V1 because V has really been created.

168
00:10:28,220 --> 00:10:32,290
Now this is new we call okay.

169
00:10:32,340 --> 00:10:33,570
So what will happen now.

170
00:10:34,950 --> 00:10:37,610
So what is happening here is that this line what will happen.

171
00:10:37,890 --> 00:10:43,820
So this is when and this even points to a vehicle object.

172
00:10:43,830 --> 00:10:51,830
So this is a vehicle object and this is a vehicle point that even is a vehicle pointer size will be

173
00:10:51,830 --> 00:10:54,820
eight bytes okay.

174
00:10:54,830 --> 00:11:00,850
Now what if I create another object let's say I am creating what if I will right.

175
00:11:00,860 --> 00:11:02,990
Because start we do.

176
00:11:02,990 --> 00:11:03,270
Okay.

177
00:11:03,280 --> 00:11:04,480
So what will happen.

178
00:11:04,520 --> 00:11:08,080
So a view to point to a vehicle point that will be created.

179
00:11:08,120 --> 00:11:11,420
And it will point to a random garbage location.

180
00:11:11,480 --> 00:11:12,010
Okay.

181
00:11:12,020 --> 00:11:18,080
And if we want to initialize if we want to initialize this vehicle pointer Then we can pointed towards

182
00:11:18,170 --> 00:11:18,650
any vehicle.

183
00:11:18,880 --> 00:11:19,390
Okay.

184
00:11:19,390 --> 00:11:27,760
What I want to say here is let's say I am creating one motor vehicle vehicle pointer now this vehicle

185
00:11:27,870 --> 00:11:32,960
pointer is not pointing towards a vehicle it is pointing towards item then garbage location.

186
00:11:32,970 --> 00:11:37,350
And if we want to initialize this point that we can point it towards any vehicle for example we can

187
00:11:37,350 --> 00:11:43,510
write we do is we do is containing the address of we basically we do is pointing towards will.

188
00:11:44,310 --> 00:11:44,950
Okay.

189
00:11:45,060 --> 00:11:55,200
So what will happen when I write we do is so when I write we do is pointing towards we.

190
00:11:55,290 --> 00:11:59,310
So we do we do is the pointer and we Wednesday actually call object.

191
00:11:59,400 --> 00:12:02,920
So we do is pointing towards even okay.

192
00:12:03,000 --> 00:12:04,360
We can also.

193
00:12:04,380 --> 00:12:12,970
So what we can also do here is so let's come and get out so we do use a vehicle pointer but we can also

194
00:12:12,970 --> 00:12:14,580
do something like this.

195
00:12:14,830 --> 00:12:18,490
We do know points toward the car glass object.

196
00:12:18,530 --> 00:12:18,810
OK.

197
00:12:18,820 --> 00:12:20,940
We do this pointing towards the car glass object.

198
00:12:21,010 --> 00:12:26,890
So this is my God a glass object.

199
00:12:26,890 --> 00:12:31,980
See the name is C. And this is we call and this is the brain function.

200
00:12:31,990 --> 00:12:33,040
This is the brain function.

201
00:12:33,040 --> 00:12:33,550
OK.

202
00:12:33,730 --> 00:12:39,280
So what I did here is we do is now pointing towards the car glass object.

203
00:12:40,050 --> 00:12:40,320
OK.

204
00:12:40,330 --> 00:12:42,680
So this now this will be the scenario.

205
00:12:42,790 --> 00:12:43,300
OK.

206
00:12:43,450 --> 00:12:45,900
So if it is pointing towards the car glass object.

207
00:12:45,940 --> 00:12:48,120
So what we do is a basic glass pointer.

208
00:12:48,250 --> 00:12:55,180
So this is a basic glass pointer and see this is the right glass object.

209
00:12:55,240 --> 00:12:55,500
OK.

210
00:12:55,540 --> 00:12:57,850
So they raised the glass object.

211
00:12:58,360 --> 00:13:06,230
So what I want to say here is a basic glass point that can point to words are derived does object but

212
00:13:06,250 --> 00:13:07,750
divisive as that is not true.

213
00:13:07,860 --> 00:13:08,510
Okay.

214
00:13:08,560 --> 00:13:13,260
So when I write we do is pointing toward C..

215
00:13:13,300 --> 00:13:14,430
So what is the meaning.

216
00:13:14,440 --> 00:13:17,440
So basically just pointer can point to it.

217
00:13:17,470 --> 00:13:20,600
Child the glass object but the vice versa is not allowed.

218
00:13:21,010 --> 00:13:24,220
Okay now I'm explaining the whole code again.

219
00:13:24,220 --> 00:13:27,480
Okay so what is the scenario.

220
00:13:27,720 --> 00:13:31,020
Okay so we call we first of all this line we call we.

221
00:13:31,020 --> 00:13:31,980
So what is the scenario.

222
00:13:32,010 --> 00:13:35,610
Let's say this is we call view object.

223
00:13:35,610 --> 00:13:40,790
This has brain function and let's say it addresses 300.

224
00:13:40,950 --> 00:13:41,830
Okay.

225
00:13:41,910 --> 00:13:49,870
Now Ghazi so it inherits from the working class so this is C object.

226
00:13:50,030 --> 00:13:51,020
This is V.

227
00:13:51,020 --> 00:13:55,520
This is the brain function and this is the brain function.

228
00:13:55,520 --> 00:13:55,810
Okay.

229
00:13:55,810 --> 00:14:00,150
And let's say that this is 400 view dot paint.

230
00:14:00,190 --> 00:14:04,510
Pseudo argument then I'm creating and then I'm creating the object dynamically.

231
00:14:04,530 --> 00:14:12,550
Okay so this is this is V1 and this is my dynamic object.

232
00:14:12,550 --> 00:14:13,740
This is what we call object.

233
00:14:14,490 --> 00:14:15,100
Okay.

234
00:14:15,290 --> 00:14:19,580
This we call object has print function and let's say it said this is hundred.

235
00:14:19,600 --> 00:14:21,050
So we even condensed hundred.

236
00:14:21,070 --> 00:14:22,750
And it is pointing.

237
00:14:22,750 --> 00:14:23,080
Okay.

238
00:14:23,110 --> 00:14:25,590
It is pointing towards this dynamic object.

239
00:14:25,750 --> 00:14:32,530
Then I created an added dynamic object so it is not a dynamic object.

240
00:14:32,540 --> 00:14:35,590
It's a point that only okay because last pointer.

241
00:14:35,750 --> 00:14:37,970
So let's say the name is we do.

242
00:14:37,970 --> 00:14:41,280
And then v2 is pointing towards that derived class object.

243
00:14:41,750 --> 00:14:43,670
So basically it said this is for it.

244
00:14:43,680 --> 00:14:45,710
So it will contain four rendered.

245
00:14:45,800 --> 00:14:47,810
And this is the scenario.

246
00:14:47,810 --> 00:14:48,040
Okay.

247
00:14:48,050 --> 00:14:50,500
So this is the complete scenario.

248
00:14:50,580 --> 00:14:56,570
Now what will happen if I try and if I try to write this code V2 arrow print.

249
00:14:57,770 --> 00:14:59,300
Okay so what will be the output.

250
00:14:59,900 --> 00:15:01,700
So when I write V to Arrow print.

251
00:15:02,300 --> 00:15:08,430
So we have two options either this print function will be called or this print function will be called.

252
00:15:08,540 --> 00:15:09,830
Now what will happen.

253
00:15:09,830 --> 00:15:14,610
So if I will write we want not print then it is very simple.

254
00:15:14,610 --> 00:15:21,310
So even out of print then it is very simple We only have one option that is this print function.

255
00:15:21,320 --> 00:15:25,220
Okay so this print function will get called but here we do at open.

256
00:15:25,280 --> 00:15:26,430
We have two options.

257
00:15:26,540 --> 00:15:28,970
This print and this print.

258
00:15:29,030 --> 00:15:30,040
And why does the scenario.

259
00:15:30,050 --> 00:15:34,190
Because a basic last point that is pointing towards are derived class object.

260
00:15:34,460 --> 00:15:38,420
So which print function will be called.

261
00:15:38,420 --> 00:15:38,680
Okay.

262
00:15:38,690 --> 00:15:39,570
So what do you think.

263
00:15:39,590 --> 00:15:41,380
Which print function will be called.

264
00:15:41,390 --> 00:15:48,530
So one thing that is important here whenever we do something like this we do is M percent of C..

265
00:15:48,710 --> 00:15:51,340
So what happened is whenever we do something like this.

266
00:15:51,500 --> 00:15:57,800
This means so with the help of we do we can only access those properties that are present in the base

267
00:15:57,800 --> 00:15:59,200
class.

268
00:15:59,360 --> 00:16:00,200
Okay.

269
00:16:00,200 --> 00:16:05,510
Although we do as a base class point and it is pointing towards a derived class object but with the

270
00:16:05,510 --> 00:16:10,850
help of we do we can only access those properties that are present in the base class.

271
00:16:10,880 --> 00:16:14,050
So that means this print function will be called.

272
00:16:14,090 --> 00:16:17,520
Okay so this print function will be called Always remember this.

273
00:16:17,540 --> 00:16:23,450
Okay make it a point a base class pointer whenever a base class point is pointing towards or drive class

274
00:16:23,460 --> 00:16:24,090
object.

275
00:16:24,290 --> 00:16:29,720
And if you are using we do it to excess something then we can access only those properties that are

276
00:16:29,720 --> 00:16:31,130
present in the base class.

277
00:16:31,820 --> 00:16:32,310
Okay.

278
00:16:32,390 --> 00:16:34,610
Now listen this file.

279
00:16:34,610 --> 00:16:42,470
Okay so let's come on out this one and this one so we what we are doing here is I am calling the print

280
00:16:42,470 --> 00:16:53,660
function truly do Okay so I am writing here a note we can only access basic class properties properties

281
00:16:53,660 --> 00:16:55,500
that are present in the base class.

282
00:16:55,660 --> 00:16:55,940
Okay

283
00:16:58,870 --> 00:17:05,380
so that's way the output of this line will be this print function will get called output we biblical.

284
00:17:05,380 --> 00:17:10,650
Okay let's turn our file okay so this is trying I said it.

285
00:17:11,160 --> 00:17:13,610
Okay so the mistake is spelling mistake

286
00:17:16,940 --> 00:17:20,050
and similarly we did a spelling mistake okay.

287
00:17:20,220 --> 00:17:21,060
So now disconnect

288
00:17:24,670 --> 00:17:31,850
so the output is we call okay so we can only access only that we can access only those properties are

289
00:17:31,870 --> 00:17:33,750
not present in the base class.

290
00:17:33,820 --> 00:17:34,380
Okay.

291
00:17:34,510 --> 00:17:38,280
Now here it is the example of a compiled and polymorphism.

292
00:17:38,290 --> 00:17:44,020
Now why it is an example of compile time polymorphism so basically which function will be called We

293
00:17:44,020 --> 00:17:46,870
are taking that decision at the compile time only.

294
00:17:46,870 --> 00:17:47,120
Okay.

295
00:17:47,140 --> 00:17:48,970
So I am repeating myself.

296
00:17:48,970 --> 00:17:52,560
So when we write we do arrow print.

297
00:17:52,560 --> 00:17:55,890
So this is an example of compile time wildfire wisdom.

298
00:17:55,890 --> 00:18:01,110
Now why it is an example of compile time polymorphism because we are deciding at the compile time which

299
00:18:01,110 --> 00:18:02,320
function will be called.

300
00:18:02,400 --> 00:18:06,910
So we have two choices for the print function first in the Guard class print function and the second

301
00:18:06,910 --> 00:18:08,950
was that we could last print function.

302
00:18:09,030 --> 00:18:14,120
So we do first of all I don't care to whom we do is pointing.

303
00:18:14,130 --> 00:18:19,950
So we do is pointing towards the car glass the car glass derived basically derived object but I don't

304
00:18:19,950 --> 00:18:20,420
care.

305
00:18:20,470 --> 00:18:25,500
Okay so I don't care to only do it pointing since we do is a type of vehicle.

306
00:18:25,500 --> 00:18:28,910
So I will call only vehicle print function blandly.

307
00:18:29,030 --> 00:18:29,490
Okay.

308
00:18:29,640 --> 00:18:34,560
I will call you to print function vehicle print function blindly so we are deciding at the compile time

309
00:18:34,560 --> 00:18:36,450
only which function will be called.

310
00:18:36,480 --> 00:18:36,930
That's right.

311
00:18:36,930 --> 00:18:40,320
This is an example of compile time polymorphism.

312
00:18:40,340 --> 00:18:41,080
Okay.

313
00:18:41,220 --> 00:18:41,670
Thank you.
