Inheritance

  • An asymmetrical connection between 2 objects
  • Is-a” Relationship
  • shows hierarchal order between objects
  • An object can be a parent or child class
  1. Parent - base class to be used, also known as “super class”
  2. Child - derived from the parent class, also called the “subclass”

Note

parent and child classes are not interchangeable

Attributes and behavior of the parent class can be extended to the child class

Programming

extends

public class Subclass extends Superclass{ /* code */}

Note

only 1 parent class can be extended by a child class. A child class cannot have multiple parent classes.

Only the service methods(public methods) will be available to subclasses