Inheritance
PRESENTED BY
Siddhesh S. Palkar
Introduction
 It is one of the most important feature of Object
Oriented Programming
 The mechanism of deriving a new class from an
old one is called as an Inheritance.
 It is the concept that is used for reusability
purpose.
Super Class :
• Top located Class
• Service provider ( Its properties accessed by all its lower level
classes)
• It is also called as Base Class or Parent Class
Sub Class :
• Bottom located class
• The Inheritance allow sub class to inherits all the variables &
methods of their super class
Category of Classes on the Basis of
Inheritance
Types of Inheritance
 A structure having one and only
one parent class as well as a child
class.
 The keyword extends signifies
that the properties of a super class
are extended to the sub class.
 Child class is authorized to
access the property of Parent Class.
Single Inheritance
Parent Class
Child Class
class A
{
……………………
……………………
}
class B extends A
{
……………………
……………………
}
Syntax
Parent
Class
Child
Class
Sharing of
Properties
Multilevel Inheritance
Parent Class
Child Class
 A standard structure of single
inheritance having one parent class,
one or more intermediate class and
one child class.
 Child class as well as intermediate
class may access the properties of
upper level classes.
 The chain is known as Inheritance
path this process may be extended to
any number of levels.
Intermediate
Class
class A
{
……………………
……………………
}
class B extends A
{
……………………
……………………
}
class C extends B
{
……………………
……………………
}
Syntax
Parent
Class
Intermediate
Class
Child
Class
Hierarchical Inheritance
Parent
Class
Child
Class
 A structure having one parent
class and more than one child
classes.
 Child class must be connected
with only parent class.
class A
{
……………………
……………………
}
class B extends A
{
……………………
……………………
}
class C extends A
{
……………………
……………………
}
Syntax
Parent
Class
Child
Class
Child
Class
Limitations
 A Link is establish into single
direction.
 Java not supports Multiple
Inheritance as well as Hybrid
Inheritance
 The extends keyword permits
to connect a class with only one
class.
Sharing of Properties
Thank You

Inheritance

  • 1.
  • 2.
    Introduction  It isone of the most important feature of Object Oriented Programming  The mechanism of deriving a new class from an old one is called as an Inheritance.  It is the concept that is used for reusability purpose.
  • 3.
    Super Class : •Top located Class • Service provider ( Its properties accessed by all its lower level classes) • It is also called as Base Class or Parent Class Sub Class : • Bottom located class • The Inheritance allow sub class to inherits all the variables & methods of their super class Category of Classes on the Basis of Inheritance
  • 4.
  • 5.
     A structurehaving one and only one parent class as well as a child class.  The keyword extends signifies that the properties of a super class are extended to the sub class.  Child class is authorized to access the property of Parent Class. Single Inheritance Parent Class Child Class
  • 6.
    class A { …………………… …………………… } class Bextends A { …………………… …………………… } Syntax Parent Class Child Class Sharing of Properties
  • 7.
    Multilevel Inheritance Parent Class ChildClass  A standard structure of single inheritance having one parent class, one or more intermediate class and one child class.  Child class as well as intermediate class may access the properties of upper level classes.  The chain is known as Inheritance path this process may be extended to any number of levels. Intermediate Class
  • 8.
    class A { …………………… …………………… } class Bextends A { …………………… …………………… } class C extends B { …………………… …………………… } Syntax Parent Class Intermediate Class Child Class
  • 9.
    Hierarchical Inheritance Parent Class Child Class  Astructure having one parent class and more than one child classes.  Child class must be connected with only parent class.
  • 10.
    class A { …………………… …………………… } class Bextends A { …………………… …………………… } class C extends A { …………………… …………………… } Syntax Parent Class Child Class Child Class
  • 11.
    Limitations  A Linkis establish into single direction.  Java not supports Multiple Inheritance as well as Hybrid Inheritance  The extends keyword permits to connect a class with only one class. Sharing of Properties
  • 12.