 Hello friends, I am Nawal Emul working as an assistant professor in Mechanical Department, Vulture Institute of Technology, Swalapur. In this video, we are going to see classes and objects. Learning outcome. At the end of this session, students will be able to learn and develop the programs using classes and objects in C++. Content. Introduction. Second is specifying a class, objects, then defining member functions. And lastly, we are going to see a program based on class and objects. Introduction. Definition of a class. The class is a collection of objects of similar type. The entire set of data and code can be made user defined with the help of a class. Objects are the variables of type class. Once the class has been defined, we can create any number of its object. We will see the examples in the next slides. Specifying a class. So the class is defined by a class keyword. And the class contains data members, which is also called as attributes. The class has operations or member functions or methods. The body of class is enclosed within braces and terminated by a semicolon. The class contains declarations of variables and functions. The variables and functions are collectively called as members. The variable declared inside the class are known as data members and the functions are known as member functions. Yet the important point in classes are access specifiers or visibility levels are classified in two parts. Those are public and private. So the general form of class declaration is mentioned below here. So the class is a keyword and the student here student is a class name. So inside the braces, they have a class private and public. So the data members should always be in private and the member functions should always be in public. So we'll see in detail what is private and public that is access specifiers in the next slide. So here as a figure one shows in private you have data members as well as member functions. In public you have the data members and member functions. But in public can only be accessed from outside the class also but in private is accessed only within the class and there is no entry outside the class. So whatever you write in private that can be accessed only within the class and no one outside the class can access the private data but whatever we write in public we can access within the class also and outside the class also. So this is a representation of the classes. So next we're going to see objects. Objects are the basic runtime entities in object oriented systems. They may represent a place, a bank account, a table of data or any item that the program must handle. For example here class is a keyword and rectangle is a class name. Then as we have discussed private and public, private the data members like we have taken a data type integer, length, breadth and area. Public we can write public here member functions. Then your main program starts here that is void main then class name is called that is rectangle after rectangle R1 and R2 are the objects which are created in this example. The example of class and object. So we'll see the example of real life entities like fruit here in fruit we have many types like mango, apple and banana here the fruit is a class and mango, apple, banana you can create n number of objects these are called as objects. So you can see one more example of class and object like you can call a car as a class and inside the car you have n number of objects can be created like Mercedes then BMW then Audi these can be called as objects. So objects are created with the help of real life problems or real life entities and objects can be created n number of times. So here while defining a member functions it can be of two types that is defining or outside the class definition and second is inside the class definition. So we'll see the examples of outside the class definition and inside the class definition. So here first number that is outside the class definition shows here class rectangle we have taken private and public in private data members are mentioned in public member functions are mentioned. So the class is terminated by semicolon after the class we have called the class again that is void rectangle then we have used scope resolution operator and accept then we can write within the bracket like see out see in void rectangle we can calculate there and then by using void rectangle we can display the output. So the first shows the outside the class definition similarly if we see the inside the class definition here also we have taken a class rectangle private there are data members but here the difference between outside and inside is here in public data member functions are defined and after that after that they have data members after the member functions they have directly given the brackets and here see out and see is used and in void calculates the calculations are done and the display is given. So here you can see the difference in outside the class after terminating the class then again we call the class here but inside the class definition we use the member functions inside the class itself. So we will see a program using the class write a program to declare a class rectangle having data members length and breadth accept this data for one object and display area and perimeter of rectangle. So I will give you few seconds to think on the program using class as a rectangle and data members as length and breadth you can pause the video for 10 15 seconds then think okay. So here I have done a program in turbo C++ so here class rectangle is used I have taken a data members like integer length breadth and area then public so void I have done the program with the help of inside the class definition. So you can see inside the class the member functions are defined void accept then see out and see in enter the length and breadth and those are stored in L and B. The next member function is void calculate A is a variable again so A equal to L into breadth and next member function is void display see out display A. So now the class is terminated the main program starts here that is void main. I have called the class name as rectangle followed by an object I am creating an object R the next line R dot accept R dot calculate and R dot display get CH and the output for this program will be enter the length and breadth if you enter five as length and six at breadth the output will be 30. So these are the references I have used thank you.