We are missing out.
Let me open the terminal for you.
Yes, that.
So you can see here, this is an example of this class in C++ here.
I have created a class named Goch.
I have followed the syntax.
So here you can see this program I have created to explain how classes works.
So if you can notice here I have used Laskey keyword and this is all about vehicles.
OK?
This is all about cars.
So we are creating a class name car and it's having public access specify.
And it's having a string brand.
String is used to create things like we have already covered that portion, so it will be like brand.
Then the next string will be model.
So we have no strings created.
One is brand and one is that these values are used to store brand name and model number of that car.
Then we have integer year.
So it's like year manufacturer of that.
So we have three data members included.
Now, if you want to create a car for BMW, you need to create an object of this class car for that.
Here again, see God God object one.
This is this index, Scott, which is a glassy, then the object name.
Then you can see each values of that particular object.
God object.
One not brand will set the values brand God object one not model equal to x five who said that value.
You can just scan or like you can just see in all see all this value that's necessary.
It's very simple to access the data members of the class.
These are the data members, which other variables you can just use scene and code and you can use the
object name dark operator.
This is called dark operator.
Then that variable name or the functioning.
This is how you access that members of that class.
Similarly, I'm creating an object for card number two, which is four, and I'm giving the values of
brand more aligned here.
Then after that, I'm counting the values so that look, I'm let's see in that program.
So you know how you can execute the program.
Before that, you need to change the directory to stop.
We inside desktop.
Now you want to compile a program in C++ glasses, not CPB.
It's compiled because there are no ETA, so no messages.
Now we can run this program dot slash here out.
You can see the car object, one dog, Brian, first got me right.
Brand more element.
Yes.
Second car brand more alignment here.
So this is how you create kind of glass and access to values or create objects and then give the values
to that objects.
OK, so now we can again move to our class section.
So we have covered all this.
Now we are in demo.
We have covered that.
Now let's go to access to finance.
So in the same class, we use some access specify that I have already shown you one to specify which
is public.
So in case of C++, it's more of a secure language, which means that only people are objects or functions
who are supposed to get the access of that particular data will get access to the data so they're data
protected.
Keep somebody outside of the scope of the program or scope of the class.
They won't be able to access the data or who have the permission to access.
The data will be given access to data.
So in case of setting up this permission, we use something called access.
Specify us in C++.
So there are only three access better ways in particular in C++ that is accessible via public, private
and protected.
So how these are used, that is one thing which we need to identify.
So if you declare all the data members or functions inside access label called public, then those members
that are accessible from outside the class, they can be accessible everywhere on the program.
But in the case of private members can only be accessed or viewed from outside that class.
So it's more secure if somebody is not having program code is, I would say, the class, then those
snippets will not be accessible because those data members or member functions are always private if
they are private.
We cannot access them from outside.
The class only class can access that data members and function, so you will get it.
While I show some, no protector is another third type.
So in case of protected members cannot be accessed from outside the class, but they can be accessed
in inherited classes.
We will be covering in had an inheritance topic later.
So anyway, the thing is like it cannot be accessed if something is protected.
It is similar to private, but it cannot be accessed in a like from outside the class.
But if we are accessing these members from inherited classes, they can be accessed.
So we will be covering more on this some inheritance part.
Now let's move on to the demo.
So here I have access specify if you can see how you can use access.
Basically, I saw these two statements I don't need to explain to you.
We are much ahead of that topic now.
We have defined a class named my class and I have created a public access, specify it and I invite
all the variables and functions associated with that in the public access.
Specify So index.
I have to find that private and another access because of how you so you can with multiple access based
bias or trees.
There those you can use inside your class and you can define that security of your functions and variables.
So here I have created one more access base via its private.
Then it should be like member functions and data member should be defined out here.
Here I have only one data, but it's white, so I have defined that data member white on to the private
access specify.
So a lot of things comes under this private access specified will be private and what things comes under
public will be public.
This variable can be accessed everywhere, but this variable can be accessed only inside the class.
Now let's see.
I have created an object of the class, my class name, object name.
I have created it, so my object is my object.
So I want to assign the value of X variable in my object equal to 25.
And why variable on my object equal to see what you can see or hear.
X is a public variable, so I will be able to access it down that same divide.
So this is allowed.
So that's a comment.
And why is not allowed?
Because Y is a private variable.
So I cannot say it like this, but you are like seeing our already set like this.
So let's see how the program will respond if I'm trying to set the value of it.
Private variable.
OK.
So let's start again with G Plus Plus for compilation D-plus Plus Access C Axis C dot CBB.
Yes or no, it's not that data.
A C C OK, there should be two CRT, so it's OK.
Right?
So you are going to see, as I have already mentioned in the car, come in.
This program is not even getting compare because.
This thing that is being very variable is declared private.
It's already drawn by the campaign out of here, not declared private yet, so invite private attributed
to private activities even showing that line?
No.
So you cannot are saying the values to private.
So what we can do, we can come in this private given out here, then what will happen?
This will be also public, right?
Public index in right now.
Let's combine this program again.
What will happen?
See, I haven't saved this file.
So that's why it's coming up again.
No way we can beat this.
OK?
OK.
See, there are no arrests breaking apart again.
Hope you are able to see.
I was able to compile this access specified or C++ completely without any error.
So no errors are that.
So that's it.
So that's what you have to notice.
Soif and variable is private.
It will not be able to be accessed outside the glass, but if it is only public, you can access it.
So private makes sure that your data members are protected, so you will be thinking of how you will
be able to access private.
So let me put this again and commend it.
And I am trying to access the Y Equal to an order here, and I'm trying to print why you are here.
See out.
Wait.
Will this happen?
Let's see.
This statement is not allowed, right?
So I am commenting it now.
I am trying to execute this program again.
OK, duplicate.
No way.
OK, so due to some specification issues, data that's not showing up on this thing.
So anyway, I was trying to show white to you, but Weisz not getting access.