Inheritance in C++
In this blog, I’m explaining about 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++
Inheritance (also known as Virtual
Access Specifier BaseClass
In Single Inheritance base class functionality access in derive class.
Multilevel Inheritance a Derived
class can also inherited by another class
Inheritance is that in which a class inherits the features from two Base
Classes when a Derived Class takes features from two Base class
Hierarchical Inheritance in which a Base class is inherited by
many sub class.
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.
void get(double l,double b)
Rectangle //Single inheritance
cout<<"Area of cube";