In this blog, I’m explaining about Inheritance in C++
Inheritance is the ability to create a class from another class, the “parent” class, extending the functionality and state of the parent in the derived, or “child” class. It allows derived classes to overload methods from their parent class.
Types of inheritance in C++
1. Single Inheritance
2. Multilevel Inheritance
3. Multiple Inheritance
4. Hierarchical Inheritance
5. Hybrid Inheritance (also known as Virtual Inheritance)
Class DeriveName: Access Specifier BaseClass
1. In Single Inheritance base class functionality access in derive class.
2. In Multilevel Inheritance a Derived class can also inherited by another class
3. Multiple Inheritance is that in which a class inherits the features from two Base Classes when a Derived Class takes features from two Base class
4. Hierarchical Inheritance in which a Base class is inherited by many sub class.
5. Hybrid Inheritance : This is a Mixture of two or More inheritance and in this Inheritance a Code may contains two or three types of inheritance in single code.
// Inheritance.cpp : main project file.
using namespace System;
using namespace std;
void get(double l,double b)
public class Cube:public Rectangle //Single inheritance
public: double height;
void get(double l,double b,double h)
int main(array<System::String ^> ^args)
cout<<"Area of cube";