 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can implement single inheritance in C++. Before starting, you can note my details. You can follow my YouTube channel that is sanjaygupta underscore tax school. You can download my app Techimage that is available on Google Play. Now coming on to the topic. In this video, I am going to implement single inheritance in C++. First of all, I am including a header file that is IO stream. Then I am using a namespace std. Now I am implementing a class that is person. Here I am declaring two attributes ID and name. Then in public section, I am implementing read function. Here I am implementing see out, which will display enter ID on console. Then seen will read ID in ID variable. Then again, I am implementing see out, which will display a message enter name. Then seen will read name in name variable. So this is the implementation of read function. Now I am defining print function. It will display entered ID and name on console. So this is definition of print function and terminating person class. Now I am implementing second class that that is student. Then colon sign public person. This colon sign indicates that I am inheriting person class into student class. In student class, I am declaring a attribute roll number and second attribute is branch. Then in public section, I am going to define some functions. First function is read. Now before writing statements for reading roll number and branch for student, I am calling person class read function. So I have written person scope regulation read. Why so? Because in both the classes name of read is same. If I if I have used different names, then I can remove this person and scope regulation. But here names of read function in both the classes are same. That's why for base class function, I am using a class name scope regulation and read. So this will call a person class read function. Now I am writing statements for student class. So it will display enter roll number message. Then scene will read roll number. Again see out. It will display the message enter branch and scene will read respective branch. So this is the definition of read function. Now I have to define print. So as in read function, I have called read of person class. So similarly, I am calling print function of person class through this statement. So this is representing base class person and it is calling print function of person class. Now I am going to print roll number of student and then branch. This is complete implementation of student class. Now I am terminating it. Then I have to implement main function inside main function. I just have to declare a object of student class s. Now I am calling read function and I am calling print function. This is the complete implementation of this program. So you can see from the beginning person class which is having id and name as attribute. Then read function is implemented and then print function. Then person class is inherited into student class. Student class is having to attribute roll number and branch. Then inside read function of student class, person class read function is called. Then roll number and branch is received through see out and scene and read function of student class. Similarly in print function, print function of person class is called. And then roll number and branch are displayed using see out. Then in main function, I have created object of drive class that is student and read and print functions are called. So this read and print will be called of student class, but student class is internally calling person class read and print function. So while this program will be executing first person class details will be entered. And then student class details will be entered. So I am executing this code now. You can see it is asking for id. I am entering triple one. Then it is asking for name. I am entering Sanjay. It is asking for roll number. I am entering 12. It is asking for branch. I am entering CS. And you can see all the results are displayed on console. So first it is asking person related details and then student related details. And all the information are received through a single object that belongs to student class. And this student class is known as derived class. So this is the demonstration how you can implement single inheritance in C++. I hope you have understood how we can implement single inheritance in C++. If you want to watch more programming related videos, you can follow my YouTube channel that is sanjaygupta underscore tech school. And you can also download my app TechMS that is available on Google Play. Thank you for watching this video.