0% found this document useful (0 votes)
71 views11 pages

PRESENTATION

The document discusses inheritance in object-oriented programming. Inheritance allows a child or derived class to inherit properties and methods from a parent or base class. This allows code reuse and reduces redundancy. There are different types of inheritance based on the visibility mode (public, private, protected) which determines how members of the parent class are available in the child class. Inheritance creates a hierarchy between classes and helps in application development by reducing memory usage, development time and execution time.

Uploaded by

Manish Hooda
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)
71 views11 pages

PRESENTATION

The document discusses inheritance in object-oriented programming. Inheritance allows a child or derived class to inherit properties and methods from a parent or base class. This allows code reuse and reduces redundancy. There are different types of inheritance based on the visibility mode (public, private, protected) which determines how members of the parent class are available in the child class. Inheritance creates a hierarchy between classes and helps in application development by reducing memory usage, development time and execution time.

Uploaded by

Manish Hooda
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/ 11

Inheritance

and Class
Hierarchy
Submitted By:
Manish Kumar
MCA 2019
INHERITANCE

• Derive quality and characteristics from parents or ancestors.


• Like you inherit features of your parents.
• one of the fundamental features of object-oriented programming
• The process of obtaining the data members and methods from one class
to another class is known as inheritance
• Show the relationship between two or more classes.
• Inheritance makes the code reusable

17-02-2020 2
BASE---->DRIVE

• The class whose properties are


inherited by other class is called
the Parent or Base or Super
class.
• And, the class which inherits
properties of other class is called
Child or Derived or Sub class

17-02-2020 3
ADVANTAGE

• Application development time is less


• Application take less memory.
• Application execution time is less.
• Redundancy (repetition) of the code is reduced or minimized

17-02-2020 4
BASIC SYNTAX--EXAMPLE
class base_class class Account {
{
public:float salary = 60000;
Properties.....
Methods....... };
}; class Programmer: public Account {
class drived_class : visibility_mode base_class public:float bonus = 5000;
{
Properties..... };
Methods....... void main() {
}; Programmer p1;
cout<<"Salary: "<<p1.salary<<end
17-02-2020 l; 5
INHERITANCE VISIBILITY
MODE
• Depending on Access modifier used while inheritance, the availability of class
members of Super class in the sub class changes.
1. Public Inheritance
• the protected member of super class becomes protected members of sub class and
public becomes public.
2. Private Inheritance
• the protected and public members of super class become private members of derived
class.
3. Protected Inheritance
• the public and protected members of Super class becomes protected members of Sub
class.

17-02-2020 6
INHERITANCE
VISIBILITY MODE

17-02-2020 7
TYPES OF INHERITANCE

17-02-2020 8
TYPES OF INHERITANCE

17-02-2020 9
CLASS HIERARCHIES

17-02-2020 10
THANK YOU

17-02-2020 11

You might also like