Code Safari

Chapter 100·Beginner

Inheritance: Defining a Type in Terms of Another

01 / 04

The core idea

One type built on another.

A subclass inherits a parent's data and behaviour, then adds or changes what's specific to it — reusing the shared parts instead of rewriting them.

Inheritance: Defining a Type in Terms of Another | Code Safari