11.10 Inheritance Between Classes

Inheritance Overview

In the Point Tracker web page, we needed only one class—a Point class—to organize the web page’s object data. For more complicated web page logic, you might need more than one class. In this section, we introduce the concept of inheritance between classes, where one class is a parent of one or more other child classes. As with biological children, a child class inherits the characteristics of its parent class. With JavaScript, a child class inherits a parent class’s properties and methods.

A parent class describes features that are common to all of its child classes. For example, suppose you have a web page that keeps track of a company’s employee information. All employees have a name ...

Get Web Programming with HTML5, CSS, and JavaScript 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.