7.8. Inheritance
Inheritance is the process by which a new class is built on top of a previously written class without the existing class's functionality needing to be rewritten. The extends keyword is used to indicate that one class inherits from another. The original class is usually referred to as the parent class or superclass (called base class in C++ lingo). The new class is known as the child class or subclass (called derived class in C++ lingo). The new child class inherits the nonprivate instance variables and methods but not the constructors of the parent class. However, a constructor in a child class can explicitly call the constructor in the parent class by using super on the first line of the new constructor. Here is a simplified ...
Get Core Web Programming, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.