liveBook · Manning

Inheritance

As explained in Grokking Software Architecture

Inheritance is an object-oriented language feature that allows a new class to acquire properties and methods from an existing class.

Inheritance lets a new class acquire properties and methods from an existing class, then add features of its own. It is one of the core ideas of object-oriented programming. section 3.4 section 3.8

A shared app blueprint

Imagine a Base App that defines an icon and a name. A Game App and a Bank App inherit those features, then add their own: an alien character or a security shield. section 3.4

A changing hospital simulation

A TreatmentRoom can handle different patient types. Adding an EmergencyPatient type without changing the room code illustrates how inheritance-related OOP concepts can support extensibility. section 3.8

How Grokking Software Architecture covers it

How deep it goes
Defines inheritance and illustrates it with app and patient examples, without detailing implementation mechanics.
Examples
Illustrates inherited app icons and names, plus a hospital TreatmentRoom that accommodates different patient types.
What you can do after
Understand how classes can inherit shared features and add specialized ones.
How it connects
Connects inheritance with object-oriented programming, classes, polymorphism, and the Open/Closed Principle.

Also explained in

Compare how 23 books explain inheritance →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.