 This is Siddish Kumar Uttaki working as assistant professor in Department of Mechanical Engineering Vyalchand Institute of Technology, Sholapur. So today we will be discussing on programs on C++, some of the programs where I am using the basic concepts discussed in the last video lectures like the classes, objects, abstractions and data encapsulation, polymorphism, inheritance, dynamic binding and message passing. Learning outcome. At the end of this session, students will be able to understand and write programs using classes and objects concepts in C++. The following contents will be discussed in this video lecture. Program using function definition within the class, second the program using function definition outside the class. Program using function definition inside the class. So we will be discussing how to write a program, what do you mean by this function definition inside the class. It means you are defining the function definition means what is the function performing, how is it executing all the thing within the class. We know that a class is a collection of different data members and member functions into a single class unit and the instances of the class are called objects. So whenever you write a program in either C or C++ it includes the different header files, pre-processor direct use. So in C++ whenever you write a program it includes hash include iostream.h, in WC it will be iostream.h, in code blocks it will be iostream. Then this iostream it means input output stream header file. It means it has two functions that is cout and seen. Cout works for the printing. I want to display something output on the screen then I will be using cout. If you want to get the input from the user I will be using seen function. Then using namespace std. This is used to increase the scope of the identifiers std stands for standard. Basically the program is about getting the input from the user like his name, his age using some get data function and displaying the output on the screen. So there are two functions I am writing. So you are packing two data members. The data members are nothing but your name and age and output is displayed using the display function on the screen. So it basically starts with declaring the class. So it is same like declaring a data type. Class person. Class is the keyword and person is the class name. Then opening the curly brace. Then character name of 30 it means name is a variable of 30 characters. Then again int age. Age is a variable of data type integer. So this two variables are under private it means they are private. They will not be able to be accessed by any other persons outside this class. Then public access modifier it means this functions can be accessed by the other objects and other classes. Void get data for getting the input from the user. I am defining this function as it is function definition inside this class. Void get data what is the what doesn't have any written type. It doesn't return any value get data is the function name then see out double lesser than enter the name of the person. So double lesser than is called insertion operator. So enter the name of the person is after the insertion operator will get displayed on the screen automatically. So whatever is after the insertion operator will be easily displayed on the screen. Then seen name it works as a scanf. So seen extraction operator name. So then the name is input by the user through the keyboard and this will be inserted into the variable called name. Then see out enter the age of the person. So enter the age of the person will be displayed on the screen easily. Then seen age the ages input from the user then void display. So this is a function to get whatever the input from the user is displayed on the screen. So I'll say see out insertion operator the name of the person is then insertion operator name I want it to be displayed on the screen. Then I'll use endel it works as a slash n that we have used in the C language. It means terminating the line or ending the line. Then afterwards the age of the person will be printed onto the next line. Then age will be printed. I'll be ending the function then afterwards ending the class. So after this we have left with the main function int main. It will return a type zero. Then I'll be creating the object person P. It means class then afterwards person is the class name and P is the object created. So I want to access the function then I'll be using object dot function name. So it will be P dot get data to get the input from the user then P dot display to get the data displayed on the screen then I'll use return zero. So this is how you write a simple program in C++ using function definition inside the class. Now pause this video for a few seconds and try to write answer to the following question. In C++ a function contained within a class is called a member function. Is it true or false? Yes. Yes, it is true. The function content within the class is called a member function. Now we'll be checking a program using function definition outside the class. You're defining the function outside the class using a scope resolution operator double semicolon symbol. So it's a program of getting the input of the student, his name, his roll number, his percentage and displaying it on the screen finally. So whenever you write a program using function definition inside the class or outside the class. So the common is the header file hash include IO stream. It means input output stream header file which includes two functions that is see out and seen. Then using namespace sd then I'll declare a class called student. It has various data members called character name of 20. It means the name is a variable of 20 characters, maximum 20 characters. I can feed it into it. Then I'll input roll number. It's a type of integer. Then float percentage. Then afterwards public accept is a function which is declared. Then display is a function, another function which is declared. I'll be ending the class. Now I'll be defining the ways functions outside the class. If I want to define the functions outside the class, I'll be using a scope resolution operator and the class name. So void student accept. So it belongs to a class called student except function. So I have written the student then scope resolution operator except function name. Then I'll start with it again. Then see out, insertion operator enter the name of the student. So this will be displayed on the screen directly, seen, extraction operator name. Then see out, again insertion operator enter the roll number. Again this will be displayed on the screen, seen, roll number, see out, enter the percentage. Using the insertion operator, seen, extraction operator through the keyboard. The percentage value is input through the keyboard. Then I'll end the function definition. So now I have to define once one more function that is display function. So that is again the written type, class name, scope resolution operator and the function name. So I'll be displaying it using the see out function. See out, insertion operator, the name of the student is name and L for terminating the line. Then see out, the roll number is, I'll be calling the variable that is roll number, roll underscore number, I'll be ending the line, see out, the percentage is, then I'll be calling that particular variable, I'll be ending this function. Then I'm using the mean function. In the main function, I'll be creating the object. So what is the class name? It is the student. I'll say student s1. It means s1 is object created. Object is nothing but the instance of the class. So now through the object, I'll be calling that particular function, except function s1.except. So it will accept the data from the user, then s1.display function to get the data displayed on the screen. Then return zero, finally the data is displayed on the screen. Now these are the following reference, Object Oriented Programming with C++ by E Balaguru Swami. Thank you.