0% found this document useful (0 votes)
59 views

1815 and 1859 Inheritance in C++

Inheritance in C++ allows for the creation of derived classes from base classes. Derived classes inherit all features of the base class and can add additional, specific features. This implements an "is-a" relationship where a derived class is a more specific type of the base class. The main advantages are code reusability, faster development, and easier maintenance. The types of inheritance in C++ include single, multiple, multilevel, hierarchical, and hybrid inheritance.

Uploaded by

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

1815 and 1859 Inheritance in C++

Inheritance in C++ allows for the creation of derived classes from base classes. Derived classes inherit all features of the base class and can add additional, specific features. This implements an "is-a" relationship where a derived class is a more specific type of the base class. The main advantages are code reusability, faster development, and easier maintenance. The types of inheritance in C++ include single, multiple, multilevel, hierarchical, and hybrid inheritance.

Uploaded by

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

INHERITANCE IN C++

1815 – YASH THAKUR


1859 – VINAY GUPTA
What is an inheritance?

 Inheritance is the process by which new classes called derived classes are created from
existing classes called base classes.
 The derived classes have all the features of the base class and the programmer can choose
to add new features specific to the newly created derived class.
 The idea of inheritance implements the is a relationship. For example, mammal IS-A
animal, dog IS-A mammal hence dog IS-A animal as well and so on.
FEATURES/ADVANTAGES OF
INHERITANCE

 Reusability of code.
 Saves time and effort.
 Faster development, easier maintenance and easy to extend.
 Capable of expressing the inheritance relationship and its transitive nature which ensures
closeness with real world problems.
DISADVANTAGES OF INHERITANCE

 Inherited functions work slower than normal function as there is indirection.


 Improper use of inheritance may lead to wrong solutions.
 Often, data members in the base class are left unused which may lead to memory wastage.
 Inheritance increases the coupling between base class and derived class.
APPLICATIONS OF INHERITANCE

 The main purpose of introducing the inheritance is to “REUSE” your code and in the
same way , when you reuse your code it means directly you OPTIMIZE your code and it
will reduce your redundancy of your code.
 Inheritance is one of the fundamental features of object-oriented programming.
The types of inheritance in c++

1)Single inheritance.
2)Multiple inheritance.
3)Multilevel inheritance.
4)Hierarchical inheritance.
5)Hybrid inheritance.
 Single inheritance : It is defined as the inheritance in which a derived class is inherited
from the only one base class. where ‘A’ is the base class, and ‘B’ is the derived class.
 Multiple inheritance : It is a feature of c ++ where a class can inherit from more than
one classes.
 Multilevel inheritance : If a class is derived from another derived class then it is called
multilevel inheritance. So in c++ multilevel inheritance , a class has more than one parent
class.
 Hierarchical inheritance: When several classes are derived from common base class it is
called hierarchical inheritance. In c++ hierarchical inheritance , the feature of the base
class is inherited onto more than one sub class.
 Hybrid inheritance: The inheritance in which the derivation of a class involves more
than one form of any inheritance is called hybrid inheritance. Basically in c++ hybrid
inheritance is combination of two or more types of inheritance. It can also be called multi
path inheritance.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy