1
00:00:05,520 --> 00:00:06,470
We are missing out.

2
00:00:06,910 --> 00:00:08,550
Let me open the terminal for you.

3
00:00:08,880 --> 00:00:09,870
Yes, that.

4
00:00:11,120 --> 00:00:17,670
So you can see here, this is an example of this class in C++ here.

5
00:00:17,690 --> 00:00:20,060
I have created a class named Goch.

6
00:00:20,510 --> 00:00:22,230
I have followed the syntax.

7
00:00:22,280 --> 00:00:27,800
So here you can see this program I have created to explain how classes works.

8
00:00:27,830 --> 00:00:33,030
So if you can notice here I have used Laskey keyword and this is all about vehicles.

9
00:00:33,050 --> 00:00:33,470
OK?

10
00:00:33,500 --> 00:00:34,910
This is all about cars.

11
00:00:35,210 --> 00:00:40,260
So we are creating a class name car and it's having public access specify.

12
00:00:40,280 --> 00:00:42,650
And it's having a string brand.

13
00:00:42,710 --> 00:00:49,580
String is used to create things like we have already covered that portion, so it will be like brand.

14
00:00:49,610 --> 00:00:51,620
Then the next string will be model.

15
00:00:51,830 --> 00:00:53,680
So we have no strings created.

16
00:00:53,700 --> 00:01:01,400
One is brand and one is that these values are used to store brand name and model number of that car.

17
00:01:01,460 --> 00:01:03,610
Then we have integer year.

18
00:01:03,710 --> 00:01:06,410
So it's like year manufacturer of that.

19
00:01:06,830 --> 00:01:10,540
So we have three data members included.

20
00:01:10,580 --> 00:01:16,820
Now, if you want to create a car for BMW, you need to create an object of this class car for that.

21
00:01:17,030 --> 00:01:19,790
Here again, see God God object one.

22
00:01:19,880 --> 00:01:24,120
This is this index, Scott, which is a glassy, then the object name.

23
00:01:24,200 --> 00:01:27,440
Then you can see each values of that particular object.

24
00:01:27,440 --> 00:01:28,130
God object.

25
00:01:28,130 --> 00:01:35,270
One not brand will set the values brand God object one not model equal to x five who said that value.

26
00:01:35,300 --> 00:01:40,550
You can just scan or like you can just see in all see all this value that's necessary.

27
00:01:40,700 --> 00:01:44,240
It's very simple to access the data members of the class.

28
00:01:44,270 --> 00:01:51,050
These are the data members, which other variables you can just use scene and code and you can use the

29
00:01:51,050 --> 00:01:53,040
object name dark operator.

30
00:01:53,060 --> 00:01:54,590
This is called dark operator.

31
00:01:54,740 --> 00:01:57,350
Then that variable name or the functioning.

32
00:01:57,350 --> 00:02:00,200
This is how you access that members of that class.

33
00:02:00,410 --> 00:02:06,590
Similarly, I'm creating an object for card number two, which is four, and I'm giving the values of

34
00:02:06,590 --> 00:02:08,100
brand more aligned here.

35
00:02:08,120 --> 00:02:13,510
Then after that, I'm counting the values so that look, I'm let's see in that program.

36
00:02:13,520 --> 00:02:16,130
So you know how you can execute the program.

37
00:02:16,130 --> 00:02:19,430
Before that, you need to change the directory to stop.

38
00:02:19,770 --> 00:02:21,050
We inside desktop.

39
00:02:21,410 --> 00:02:27,660
Now you want to compile a program in C++ glasses, not CPB.

40
00:02:27,680 --> 00:02:31,520
It's compiled because there are no ETA, so no messages.

41
00:02:31,550 --> 00:02:35,240
Now we can run this program dot slash here out.

42
00:02:37,040 --> 00:02:41,580
You can see the car object, one dog, Brian, first got me right.

43
00:02:41,680 --> 00:02:43,100
Brand more element.

44
00:02:43,310 --> 00:02:43,720
Yes.

45
00:02:43,790 --> 00:02:46,610
Second car brand more alignment here.

46
00:02:46,850 --> 00:02:54,620
So this is how you create kind of glass and access to values or create objects and then give the values

47
00:02:54,620 --> 00:02:55,880
to that objects.

48
00:02:55,970 --> 00:02:59,780
OK, so now we can again move to our class section.

49
00:02:59,930 --> 00:03:01,550
So we have covered all this.

50
00:03:01,580 --> 00:03:03,110
Now we are in demo.

51
00:03:03,110 --> 00:03:04,160
We have covered that.

52
00:03:04,310 --> 00:03:06,860
Now let's go to access to finance.

53
00:03:07,040 --> 00:03:13,790
So in the same class, we use some access specify that I have already shown you one to specify which

54
00:03:13,790 --> 00:03:14,540
is public.

55
00:03:14,630 --> 00:03:22,820
So in case of C++, it's more of a secure language, which means that only people are objects or functions

56
00:03:23,150 --> 00:03:29,120
who are supposed to get the access of that particular data will get access to the data so they're data

57
00:03:29,120 --> 00:03:29,860
protected.

58
00:03:29,890 --> 00:03:35,530
Keep somebody outside of the scope of the program or scope of the class.

59
00:03:35,540 --> 00:03:40,010
They won't be able to access the data or who have the permission to access.

60
00:03:40,010 --> 00:03:42,270
The data will be given access to data.

61
00:03:42,290 --> 00:03:46,850
So in case of setting up this permission, we use something called access.

62
00:03:46,850 --> 00:03:48,790
Specify us in C++.

63
00:03:48,830 --> 00:03:56,360
So there are only three access better ways in particular in C++ that is accessible via public, private

64
00:03:56,360 --> 00:03:57,260
and protected.

65
00:03:57,290 --> 00:04:01,190
So how these are used, that is one thing which we need to identify.

66
00:04:01,220 --> 00:04:09,740
So if you declare all the data members or functions inside access label called public, then those members

67
00:04:09,740 --> 00:04:14,800
that are accessible from outside the class, they can be accessible everywhere on the program.

68
00:04:14,820 --> 00:04:19,640
But in the case of private members can only be accessed or viewed from outside that class.

69
00:04:19,700 --> 00:04:26,030
So it's more secure if somebody is not having program code is, I would say, the class, then those

70
00:04:26,030 --> 00:04:32,690
snippets will not be accessible because those data members or member functions are always private if

71
00:04:32,690 --> 00:04:33,500
they are private.

72
00:04:33,870 --> 00:04:35,740
We cannot access them from outside.

73
00:04:35,750 --> 00:04:40,130
The class only class can access that data members and function, so you will get it.

74
00:04:40,490 --> 00:04:44,520
While I show some, no protector is another third type.

75
00:04:44,540 --> 00:04:50,120
So in case of protected members cannot be accessed from outside the class, but they can be accessed

76
00:04:50,240 --> 00:04:51,680
in inherited classes.

77
00:04:51,750 --> 00:04:55,030
We will be covering in had an inheritance topic later.

78
00:04:55,070 --> 00:05:00,950
So anyway, the thing is like it cannot be accessed if something is protected.

79
00:05:01,190 --> 00:05:06,770
It is similar to private, but it cannot be accessed in a like from outside the class.

80
00:05:06,950 --> 00:05:12,530
But if we are accessing these members from inherited classes, they can be accessed.

81
00:05:12,710 --> 00:05:16,370
So we will be covering more on this some inheritance part.

82
00:05:16,430 --> 00:05:18,050
Now let's move on to the demo.

83
00:05:18,260 --> 00:05:22,240
So here I have access specify if you can see how you can use access.

84
00:05:22,250 --> 00:05:26,140
Basically, I saw these two statements I don't need to explain to you.

85
00:05:26,150 --> 00:05:28,390
We are much ahead of that topic now.

86
00:05:28,400 --> 00:05:34,940
We have defined a class named my class and I have created a public access, specify it and I invite

87
00:05:34,940 --> 00:05:40,190
all the variables and functions associated with that in the public access.

88
00:05:40,190 --> 00:05:41,960
Specify So index.

89
00:05:41,960 --> 00:05:48,500
I have to find that private and another access because of how you so you can with multiple access based

90
00:05:48,500 --> 00:05:49,760
bias or trees.

91
00:05:49,760 --> 00:05:56,450
There those you can use inside your class and you can define that security of your functions and variables.

92
00:05:56,720 --> 00:06:00,380
So here I have created one more access base via its private.

93
00:06:00,710 --> 00:06:05,360
Then it should be like member functions and data member should be defined out here.

94
00:06:05,450 --> 00:06:11,300
Here I have only one data, but it's white, so I have defined that data member white on to the private

95
00:06:11,300 --> 00:06:12,170
access specify.

96
00:06:12,290 --> 00:06:18,170
So a lot of things comes under this private access specified will be private and what things comes under

97
00:06:18,170 --> 00:06:19,520
public will be public.

98
00:06:19,670 --> 00:06:24,950
This variable can be accessed everywhere, but this variable can be accessed only inside the class.

99
00:06:25,010 --> 00:06:25,910
Now let's see.

100
00:06:25,940 --> 00:06:30,290
I have created an object of the class, my class name, object name.

101
00:06:30,320 --> 00:06:33,350
I have created it, so my object is my object.

102
00:06:33,470 --> 00:06:38,870
So I want to assign the value of X variable in my object equal to 25.

103
00:06:38,870 --> 00:06:43,190
And why variable on my object equal to see what you can see or hear.

104
00:06:43,190 --> 00:06:47,840
X is a public variable, so I will be able to access it down that same divide.

105
00:06:47,990 --> 00:06:49,190
So this is allowed.

106
00:06:49,460 --> 00:06:50,500
So that's a comment.

107
00:06:50,510 --> 00:06:52,640
And why is not allowed?

108
00:06:52,640 --> 00:06:54,200
Because Y is a private variable.

109
00:06:54,200 --> 00:06:58,490
So I cannot say it like this, but you are like seeing our already set like this.

110
00:06:58,490 --> 00:07:03,490
So let's see how the program will respond if I'm trying to set the value of it.

111
00:07:03,530 --> 00:07:04,670
Private variable.

112
00:07:04,700 --> 00:07:05,150
OK.

113
00:07:05,300 --> 00:07:18,170
So let's start again with G Plus Plus for compilation D-plus Plus Access C Axis C dot CBB.

114
00:07:19,580 --> 00:07:23,180
Yes or no, it's not that data.

115
00:07:23,180 --> 00:07:28,060
A C C OK, there should be two CRT, so it's OK.

116
00:07:28,250 --> 00:07:28,670
Right?

117
00:07:28,820 --> 00:07:33,200
So you are going to see, as I have already mentioned in the car, come in.

118
00:07:33,200 --> 00:07:36,260
This program is not even getting compare because.

119
00:07:36,500 --> 00:07:41,210
This thing that is being very variable is declared private.

120
00:07:41,360 --> 00:07:48,620
It's already drawn by the campaign out of here, not declared private yet, so invite private attributed

121
00:07:48,620 --> 00:07:51,290
to private activities even showing that line?

122
00:07:51,290 --> 00:07:51,740
No.

123
00:07:51,950 --> 00:07:54,760
So you cannot are saying the values to private.

124
00:07:55,460 --> 00:08:00,140
So what we can do, we can come in this private given out here, then what will happen?

125
00:08:00,170 --> 00:08:01,910
This will be also public, right?

126
00:08:02,060 --> 00:08:04,160
Public index in right now.

127
00:08:04,160 --> 00:08:05,780
Let's combine this program again.

128
00:08:05,780 --> 00:08:06,500
What will happen?

129
00:08:07,200 --> 00:08:09,440
See, I haven't saved this file.

130
00:08:09,470 --> 00:08:11,000
So that's why it's coming up again.

131
00:08:11,030 --> 00:08:12,340
No way we can beat this.

132
00:08:12,350 --> 00:08:12,680
OK?

133
00:08:13,380 --> 00:08:13,840
OK.

134
00:08:14,060 --> 00:08:17,420
See, there are no arrests breaking apart again.

135
00:08:17,520 --> 00:08:18,710
Hope you are able to see.

136
00:08:18,710 --> 00:08:24,590
I was able to compile this access specified or C++ completely without any error.

137
00:08:24,740 --> 00:08:25,940
So no errors are that.

138
00:08:25,960 --> 00:08:26,650
So that's it.

139
00:08:26,660 --> 00:08:29,030
So that's what you have to notice.

140
00:08:29,040 --> 00:08:31,430
Soif and variable is private.

141
00:08:31,580 --> 00:08:37,760
It will not be able to be accessed outside the glass, but if it is only public, you can access it.

142
00:08:37,910 --> 00:08:43,790
So private makes sure that your data members are protected, so you will be thinking of how you will

143
00:08:43,790 --> 00:08:45,200
be able to access private.

144
00:08:45,230 --> 00:08:48,490
So let me put this again and commend it.

145
00:08:48,500 --> 00:08:55,850
And I am trying to access the Y Equal to an order here, and I'm trying to print why you are here.

146
00:08:56,180 --> 00:08:57,140
See out.

147
00:08:57,350 --> 00:08:57,700
Wait.

148
00:08:58,910 --> 00:08:59,810
Will this happen?

149
00:08:59,960 --> 00:09:00,460
Let's see.

150
00:09:00,470 --> 00:09:02,390
This statement is not allowed, right?

151
00:09:02,630 --> 00:09:03,980
So I am commenting it now.

152
00:09:03,980 --> 00:09:06,050
I am trying to execute this program again.

153
00:09:07,040 --> 00:09:08,330
OK, duplicate.

154
00:09:08,450 --> 00:09:09,350
No way.

155
00:09:10,430 --> 00:09:17,120
OK, so due to some specification issues, data that's not showing up on this thing.

156
00:09:17,300 --> 00:09:22,780
So anyway, I was trying to show white to you, but Weisz not getting access.
