SejalCh / Inheritance_Classes-in-CPP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inheritance_Classes-in-CPP

##AIM:To study about different types of inheritance in C++

##THEORY:

In C++, it is possible to inherit attributes and methods from one class to another. We group the "inheritance" into two categories:
derived class (child) - the class that inherits from another class
base class (parent) - the class being inherited from

Types of inheritance in C++:
1.single inheritance-The inheritance in which a single derived class is inherited from a single base class
2.multiple inheritance-A class can also be derived from more than one base class, using a comma-separated list
3.multilevel inheritance-A class can also be derived from one class, which is already derived from another class.
4.hierarchical inheritance-the type of inheritance that has a hierarchical structure of classes. A single base class can have multiple derived classes, and other subclasses can further inherit these derived classes, forming a hierarchy of classes


Single:
Screenshot 2023-10-24 171900
Multiple:
Screenshot 2023-10-24 171743
Multilevel:
Screenshot 2023-10-24 171840
Hierarchical:
Screenshot 2023-10-24 171709