[go: up one dir, main page]

0% found this document useful (0 votes)
4 views16 pages

Inheritance

Uploaded by

sowmiyasm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views16 pages

Inheritance

Uploaded by

sowmiyasm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Inheritance

Object Oriented Programming with C++


Inheritance

● Inheritance is the process by which genetic information is passed on


from parent to child
● In computer, Inheritance is a mechanism in which one class acquires the
property of another class.
Purpose of Inheritance

● The basic idea of Inheritance is to create the new class (called


child class or derived or subclass) from an existing class (called
parent class or Base or Superclass).
● That is, the child class inherits the properties (methods and
fields) of the parent class.
Base Class, Derived Class
Use of Inheritance

● Reusability
Inheritance Importance
Types of Inheritance

● Single Inheritance
● Multiple Inheritance
● Hierarchical Inheritance
● Multilevel Inheritance
● Hybrid Inheritance
Single Inheritance

● Single inheritance is defined


as the inheritance in which a
derived class is inherited
from the only one base
class.
Multiple Inheritance

● Multiple Inheritance is the


concept of the Inheritance in C++
that allows a child class to inherit
properties or behaviour from
multiple base classes.
Hierarchical Inheritance

● There is a single base class and


multiple derived classes.
Furthermore, the derived classes
are also inherited by some other
classes. Thus a tree-like structure
is formed of hierarchy.
Multilevel Inheritance

● When one class inherits


another class which is
further inherited by another
class, it is known as multi
level inheritance in C++.
Hybrid Inheritance

● In hybrid inheritance, there is a


combination of one or more
inheritance types. For instance,
the combination of single and
hierarchical inheritance.
Therefore, hybrid inheritance is
also known as multipath
inheritance.
Questions
Thank you

You might also like