Inheritance


Subclasses and Superclasses

If we have a class, e.g., OrigClass, and we want to make a new class that has many of the same features, we may be able to make a subclass of the original class.

Subclass: A subclass extends another class (known as its superclass). The syntax is:
    public class Subclass extends OrigClass
    {
        ⋮
    }

A subclass

Subclass code may directly access all inherited instance variables and methods that are public or protected (but not private).


Alyce Brady, Kalamazoo College