1
00:00:07,820 --> 00:00:08,840
Hi everybody.

2
00:00:08,840 --> 00:00:10,620
Welcome back.

3
00:00:10,740 --> 00:00:15,820
In this video we will discuss object oriented programming.

4
00:00:16,020 --> 00:00:22,040
What will be the second interactive constructor method.

5
00:00:22,040 --> 00:00:28,950
A class can define missile with special name these names begin and end with a double under this code

6
00:00:29,620 --> 00:00:37,550
one in both and its natural name is underscore underscore and it underscore underscore its the for the

7
00:00:37,550 --> 00:00:41,070
class at school.

8
00:00:41,110 --> 00:00:50,460
Each time an instance of the class is created and implementing these missiles in a class gave us a chance

9
00:00:50,460 --> 00:01:00,420
to initialize each instance of our class we will use geometry notebook for coding a class of user that

10
00:01:00,420 --> 00:01:04,950
I have the init miss which is constructor and two parameters.

11
00:01:05,130 --> 00:01:09,400
Suppose it will be a name and age of the user.

12
00:01:10,110 --> 00:01:17,640
So we will initialize our variable age and the name as follows.

13
00:01:17,850 --> 00:01:18,420
Class

14
00:01:21,030 --> 00:01:29,980
C L A S S user data in camel case.

15
00:01:30,570 --> 00:01:40,320
So user the first letter U capital and that is the first letter is d capital a member enters its close

16
00:01:40,320 --> 00:01:53,430
parentheses column enters H equal zero and the name equal none

17
00:01:57,160 --> 00:02:06,630
then where it was and will use the z defined method to create the class buddy

18
00:02:09,880 --> 00:02:12,160
define def

19
00:02:15,900 --> 00:02:19,920
double underscore and it doubled under a school

20
00:02:25,280 --> 00:02:25,760
self

21
00:02:28,400 --> 00:02:31,610
name and H

22
00:02:34,370 --> 00:02:37,610
column enter self

23
00:02:40,280 --> 00:02:43,750
that name a quote name

24
00:02:47,320 --> 00:02:50,620
and self the H

25
00:02:53,520 --> 00:02:56,270
equal H.

26
00:02:56,450 --> 00:03:06,530
Finally we will use defined methods to call the class via its any census

27
00:03:11,690 --> 00:03:12,180
define

28
00:03:19,450 --> 00:03:26,140
define the same level of either indentation of a Z fairness to defined method

29
00:03:29,020 --> 00:03:30,170
use as

30
00:03:33,070 --> 00:03:33,640
self

31
00:03:37,790 --> 00:03:50,610
then we will type Brent for example user name sorry user with capital U user

32
00:03:53,900 --> 00:03:54,380
name

33
00:03:58,720 --> 00:03:59,260
is

34
00:04:05,760 --> 00:04:07,050
two curly brackets

35
00:04:09,960 --> 00:04:10,870
and there has

36
00:04:15,380 --> 00:04:19,630
to cut the brackets is

37
00:04:23,300 --> 00:04:25,680
all full stop.

38
00:04:28,540 --> 00:04:32,840
Then double quotes that for me.

39
00:04:39,740 --> 00:04:40,280
Self

40
00:04:42,920 --> 00:04:43,540
the name

41
00:04:48,890 --> 00:04:53,640
and self that age.

42
00:04:53,680 --> 00:04:57,090
We will add users to this class.

43
00:04:57,130 --> 00:04:58,260
User 1.

44
00:04:58,800 --> 00:04:59,250
Equal.

45
00:05:00,190 --> 00:05:06,480
As we explained in the last lecture users data

46
00:05:09,340 --> 00:05:10,060
Robyn.

47
00:05:10,230 --> 00:05:15,540
But entities close but entities Sara

48
00:05:21,380 --> 00:05:27,620
comma 40 and enter 5 different users as follows.

49
00:05:39,630 --> 00:05:46,020
Two will be for example davit

50
00:05:50,070 --> 00:05:50,790
and 50

51
00:05:53,380 --> 00:05:57,090
three will be for example

52
00:05:59,770 --> 00:06:00,310
John

53
00:06:07,460 --> 00:06:08,150
and 30

54
00:06:11,480 --> 00:06:16,670
user four will be gate

55
00:06:21,260 --> 00:06:22,010
and twenty

56
00:06:24,650 --> 00:06:25,260
user five.

57
00:06:25,260 --> 00:06:30,060
For example will be beta

58
00:06:35,360 --> 00:06:46,500
and 14 Zen shift and enter Zen we will check type of users.

59
00:06:46,510 --> 00:06:51,820
1 will be mean user data.

60
00:06:51,820 --> 00:06:59,560
This means that there is a part of a class called User that the same for the rest of users.

61
00:06:59,680 --> 00:07:08,040
Then we will check user to not its

62
00:07:10,680 --> 00:07:12,030
shift and enters.

63
00:07:12,300 --> 00:07:13,440
We will get 15

64
00:07:15,930 --> 00:07:26,330
users 3 that name we will get zone

65
00:07:32,600 --> 00:07:41,000
Suppose we want to calculate their users average age we will create a function will do that.

66
00:07:41,090 --> 00:07:44,690
Def AVC under school age

67
00:07:48,370 --> 00:07:49,280
of.

68
00:07:49,380 --> 00:07:56,350
But entities close parentheses column retarded.

69
00:07:56,920 --> 00:07:58,000
Use it one

70
00:08:01,260 --> 00:08:04,720
dot age for less

71
00:08:07,680 --> 00:08:08,220
user

72
00:08:11,100 --> 00:08:17,970
to dot age plus users 3.

73
00:08:18,360 --> 00:08:20,150
What age.

74
00:08:20,150 --> 00:08:30,130
The last user for that age plus users.

75
00:08:31,010 --> 00:08:32,640
5 that age

76
00:08:40,150 --> 00:08:41,070
sorry retarded

77
00:08:44,540 --> 00:08:53,220
to retain user 1 that age user to that age user 3 that age user forwarded to the age user 5 that age

78
00:08:55,830 --> 00:09:02,450
divided by 5 the number of users.

79
00:09:03,390 --> 00:09:07,200
Then we will call that function AVC

80
00:09:10,770 --> 00:09:12,350
underscore it.

81
00:09:15,510 --> 00:09:22,690
We will get seventy one so as average age of the users is 71.

82
00:09:23,070 --> 00:09:28,010
Also we can get more information from our class as follows.

83
00:09:28,020 --> 00:09:33,280
User 1 that user.

84
00:09:35,600 --> 00:09:38,110
The second function in our class.

85
00:09:38,120 --> 00:09:40,130
Click shift and enter.

86
00:09:40,760 --> 00:09:52,370
We will get user name is Sara and has 40 years old so can get any information from our class through

87
00:09:52,760 --> 00:09:58,580
its body and its tenses and defining methods.

88
00:09:58,580 --> 00:10:04,330
We will define an asset class called rectangle and throw it any senses.

89
00:10:04,430 --> 00:10:10,530
We will calculate the area of the rectangle throw the defined method.

90
00:10:10,890 --> 00:10:16,640
See a s s Rick can tango

91
00:10:22,570 --> 00:10:28,980
enter if double underscore in it.

92
00:10:29,080 --> 00:10:32,410
Now it underscores self

93
00:10:37,280 --> 00:10:37,790
length

94
00:10:43,280 --> 00:10:44,100
and why it's

95
00:10:47,720 --> 00:10:52,610
called on self that length

96
00:10:55,730 --> 00:10:57,930
equal length.

97
00:11:06,600 --> 00:11:18,210
Self-doubt lends equal lengths so we will be fair and instances too as the parameters of saying it misled.

98
00:11:18,780 --> 00:11:20,850
Also for the lights

99
00:11:23,920 --> 00:11:25,120
it was a rectangle

100
00:11:39,110 --> 00:11:40,770
then to find another missile.

101
00:11:43,000 --> 00:11:44,460
Yes.

102
00:11:44,620 --> 00:11:52,600
Rex area which is a buddy of Zachary glass rectangle.

103
00:11:52,900 --> 00:11:59,520
We will use to calculate the area of the rectangle self.

104
00:11:59,830 --> 00:12:02,230
The same instance of the class

105
00:12:05,650 --> 00:12:06,130
created

106
00:12:11,170 --> 00:12:11,850
self.

107
00:12:14,280 --> 00:12:15,060
Docklands

108
00:12:24,090 --> 00:12:33,960
multiply by self that wife.

109
00:12:35,480 --> 00:12:44,710
Then we will define our rectangles rect underscored one equal break.

110
00:12:44,870 --> 00:12:46,070
Tango class

111
00:12:56,940 --> 00:12:57,420
Rick

112
00:13:01,960 --> 00:13:03,130
rectangle

113
00:13:06,040 --> 00:13:07,240
rectangle class

114
00:13:09,880 --> 00:13:12,430
30 and 50

115
00:13:15,620 --> 00:13:21,000
rect 1 rectangle 1 equal rig.

116
00:13:21,380 --> 00:13:36,220
Tango class 50 and 30 then rectangle 2 equal rectangle

117
00:13:39,780 --> 00:13:44,490
140 and 60.

118
00:13:44,960 --> 00:13:50,870
Rick Stengel 3 equal rectangle.

119
00:13:51,050 --> 00:13:51,560
Class

120
00:13:59,100 --> 00:14:04,620
120 and 17 rectangle 4

121
00:14:11,390 --> 00:14:14,750
equal rectangle

122
00:14:22,000 --> 00:14:22,770

123
00:14:26,620 --> 00:14:36,850
and 80 shift and enters and check for rectangle 1.

124
00:14:37,420 --> 00:14:45,160
That depth lends reacts Varia or whites.

125
00:14:45,240 --> 00:14:49,910
We will check for lengths collection and enter.

126
00:14:50,130 --> 00:14:54,170
We will get 50 rectangle 2.

127
00:14:54,510 --> 00:14:55,380
For example

128
00:14:59,990 --> 00:15:05,990
to dot tab check for whites.

129
00:15:06,350 --> 00:15:16,090
We will get 60 tangle underscores three rect underscores we got there.

130
00:15:16,850 --> 00:15:21,160
We will get uh three choices.

131
00:15:21,200 --> 00:15:25,340
We will choose rect area shift and enter

132
00:15:28,120 --> 00:15:29,760
boundaries of the rectangle.

133
00:15:29,780 --> 00:15:38,510
That area mean this because we don't edit the open and close parentheses of Z results.

134
00:15:38,890 --> 00:15:43,460
We will get 8 7 and 4 handle it.

135
00:15:43,660 --> 00:15:46,870
Then we will check for rectangle for

136
00:15:49,620 --> 00:15:49,940
diet

137
00:15:54,210 --> 00:15:54,950
type of minute.

138
00:15:54,950 --> 00:16:02,470
This is a rectangle 4 x 4 close parenthesis shift and enters an not rectangle.

139
00:16:02,490 --> 00:16:12,780
This means that rectangle 4 is a part of rectangle plus.

140
00:16:12,780 --> 00:16:16,910
Suppose we want to get the average area of all rectangles.

141
00:16:17,040 --> 00:16:30,300
We will type Brent of Amber entities req underscore one dot tap rect area but it is this close parenthesis

142
00:16:31,360 --> 00:16:39,990
to that act underscore fourth from rect underscored one to select underscores divided by the number

143
00:16:39,990 --> 00:16:49,740
of rectangles that we have in our class we will get six thousand five hundred seventy five.

144
00:16:49,830 --> 00:16:51,360
Thank you for watching.

145
00:16:51,360 --> 00:16:57,320
See you next lecture.
