Object-oriented programming is to be able to represent that car from real life in
your program, so how do we do that How can I represent a real-life entity like a
game or a sport or student or a book or animal? SO. The answer to this question is
by using classes. Now. Class is an important concept in OopS class is building block
of object-oriented programming... A class is basically user user-defined data type,
and a class is a more complex data type... First thing is you type class keyword and
then you give a name to your class. So, I 'm going to show you how you can create
a class in C code. The class that I want to create is called Employees. At. At the end
of these curly brackets, you need to put semicolon because if you do not. If you
forget this semicolon, you will get a compile time error...
Everything inside class in C plus is private by default, which means that all these
members here are private. The approach would be the following you type the name
of that object like this and then if I put dot here. We should be able to see all of the
members here but that is not happening. So why is that the case well? The problem
is that we cannot access these members of our employee class and we want to do
that so let 's try to change this private access modifier with a different access
modifier... We also said that we could describe behaviors as well so how can we
describe a behavior in this class here well? We can describe that with a class
method. IF we needed to introduce our employee five times. For example, we just
copy this function five times. Like this and our user is going to introduce himself
five times and if we did not have this class method here, we would have to copy
this code five times...Instead of doing that we can create a class method which
represents a behavior and then we can invoke that class method whenever we
need it.