9.3 Overriding Methods

Enduring Understanding

When multiple classes contain common attributes and behaviors, programmers create a new class containing the shared attributes and behaviors forming a hierarchy. Modifications made at the highest level of the hierarchy apply to the subclasses.

Learning Objective

Create an inheritance relationship from a subclass to the superclass.

Essential Knowledge

Method overriding occurs when a public method in a subclass has the same method signature as a public method in the superclass.

Any method that is called must be defined within its own class or its superclass.

A subclass is usually designed to have modified (overridden) or additional methods or instance variables.

A subclass will inherit all public methods from the superclass; these methods remain public in the subclass.

Last updated

Was this helpful?