Object Oriented Programming in JAVA
CS 201
 

Inheritance
  • On surface, inheritance is a code re-use issue.  We can extend code that is already written in a manageable manner.
     
  • Create new class from existing class
    -- Absorb existing class's data and behavior
    -- Enhance with new capabilities
     
  • Subclass extends Superclass
    -- Object of one class "is an" object of another class
    -- Rectangle is quadrilateral
    -- Class Rectangle inherits from class Quadrilateral
    -- Quadrilateral
    : superclass
    -- Rectangle: subclass
     
  • Superclass typically represents larger set of objects than subclasses
     
  • Inheritance example

     

  • Inheritane hierarchy
    -- Inheritance relationships: tree-like hierarchy structure
    -- Each class becomes superclass or subclass
     
  • Example of Inheritance Hierarchy

                             

Prev | Home | Next


Mihir Patel | CS561
Illinois Institute of Technology