 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can implement different types of inheritance in C++. Before starting, you can note my information. You can follow my YouTube channel that is Sanjay Gupta underscore tax school. You can download my Android app that is TechMS available on Google Play. Now coming on to the topic, here I will be implementing small code segments which will demonstrate you how you can implement different types of inheritance. So first I am explaining single inheritance. So I hope you know what is inheritance. In case of inheritance, there are two classes. One is base and one is derived class. Derived class inherits all the properties of base class which are available inside base class except private section. So there are three sections inside a particular class, private, protected and public. So protected and public members can be inherited into direct class but private section cannot be inherited into derived class. So if you want to implement single inheritance then first you have to implement class A. After implementation of class A, you have to implement class B. Then you can you can inherit class A inside class B like this. So this is the small example of single inheritance. I am not filling the definition. These definitions are filled my in another videos which are based on a particular type of inheritance. You can watch them if you want to learn these different types of inheritance in detail. So here class A is base class and class B is derived class. So class A is inherited into class B. Now in main function, in main function, you can create objects of both A and B. So if you want to access attributes of class A that is base class only, you can create object of A class. If you want to access properties of A as well as B, then you can create object of B class. So this is first type of inheritance that is single inheritance. Now another type of inheritance is multiple inheritance. In this type, there will be more than one base classes. So here you can see I have declared two base classes. Now I am creating another class that is C and these classes are inheriting class A and class B. So here class A and class B, both are base classes and class C is derived class. So in main function, you can create object of class A, you can create object of class B, but if you are creating object of A and B, then you can access their members only. But if you are creating object of class C, then you can access members of class A, B and C according to their access specifier that is private, public and protected. Now third type of inheritance is hierarchical inheritance. This is opposite of multiple inheritance. Here only one base class is available. This is base class and you can create many derived classes by inheriting this base class. So this is first derived class and this is second derived class. So here A is base class, class B is derived class and class C is also derived class. So this is hierarchical inheritance. In this type of inheritance, one base class can be inherited into various derived classes. Now fourth comes multi-level inheritance. In this type of inheritance, first you have to implement base class and you have to inherit this base class into derived class. Then this derived class becomes base class for further classes like this. So here you can see A is base class. Here class B is derived for A and base for C and here class C is derived class. So B class is working derived as well as base. So it is derived class for class A and it is base class for class C. So this is multi-level inheritance and you can implement it further also like class C will be base class for class D and so on. So this is multi-level inheritance. Last one is multi-path. In this type of inheritance, first you have to implement base class then derived class which will inherit this base class using virtual keyword. Another derived class also inherit A base class using virtual keyword and at last derived class which will inherit B and C. This is multi-path inheritance. Here A is inherited into B and C and then B and C are inherited into D. So if I remove this virtual keyword now you can see members of A are available with B and C. Now B and C classes are inherited into D. So members of A will be available twice inside D class and if you want to make a single copy of A class into D class then you have to use virtual keyword while inheriting A class into B and C classes. So this is all about types of inheritance. I have explained five types of inheritance that are single, multiple, hierarchical, multi-path and multi-level inheritance. I hope you have understood the difference between all these types of inheritance. If you want to watch full implementation of each type of inheritance, you can watch my videos related to those topics which are available in this playlist. If you want to watch another programming related videos, you can follow my YouTube channel that is Sanjay Gupta underscore Tech School. You can also download programming related app that is TechMS available on Google Play. Thank you for watching this video.