Inheritance
Inheritance is a mechanism by which a child type or element receives properties, values, or behavior from a parent, subject to system rules and possible overrides.
Python Workout: 50 ten-minute exercises
Inheritance is an object-oriented technique in which a class derives functionality from an existing parent class and can add or modify that functionality.
- How it is used
- Uses inheritance to organize related Python classes, reuse shared behavior, and add or modify specialized functionality.
- How deep it goes
- Traces attribute lookup through instances, classes, parents, and object, then applies super and subclass-specific class attributes.
- Examples
- Demonstrates Person and Employee, Foo and Bar, Bowl and BigBowl, FlexibleDict, and animal class hierarchies.
- What you can do after
- Build it from scratch by defining parent and child classes, reusing methods, overriding behavior, and delegating initialization with super.
Read how Python Workout: 50 ten-minute exercises explains inheritance →
Python Workout, Second Edition
Inheritance is the Python class relationship in which a derived class receives attributes and behavior from one or more base classes.
- How it is used
- Uses inheritance to organize related Python classes, reuse parent behavior, and add or modify subclass functionality.
- How deep it goes
- Traces attribute lookup through instances, classes, parents, and object, then applies inheritance through exercises and overrides.
- Examples
- Uses Person and Employee, Foo and Bar, Bowl and BigBowl, Animal subclasses, and dict extensions as implementation exercises.
- What you can do after
- Build it from scratch by defining subclasses, reusing parent initialization with super, overriding methods, and extending built-in classes.
Read how Python Workout, Second Edition explains inheritance →
100 C++ Mistakes and How to Avoid Them
Inheritance is a C++ language mechanism by which a derived class acquires and can extend members and behavior from base classes.
- How it is used
- Uses inheritance to model substitutable related types, share behavior carefully, and preserve correctness across class hierarchies.
- How deep it goes
- Explains public inheritance, substitutability, object data parts, assignment, method reuse, and virtual destruction through worked examples.
- Examples
- Uses Person and Student copying, Shape and Square destruction, and Square and Horse movement to expose hierarchy mistakes.
- What you can do after
- Diagnose inheritance defects involving substitutability, copied base state, duplicated behavior, and deletion through polymorphic base pointers.
Read how 100 C++ Mistakes and How to Avoid Them explains inheritance →
The Quick Python Book, Fourth Edition
Inheritance is an object-oriented mechanism by which a class derives behavior and structure from another class, forming a hierarchy of related classes.
- How it is used
- Uses inheritance to share behavior among related classes and customize built-in types.
- How deep it goes
- Works through declaration syntax, explicit base initialization, method lookup, attribute behavior, and subclassing pitfalls without developing OOP theory.
- Examples
- Uses movable shapes, typed lists, custom exceptions, and HTML element classes to show inherited behavior.
- What you can do after
- Build it from scratch: define Python subclasses that reuse base methods and initialize inherited attributes explicitly.
Read how The Quick Python Book, Fourth Edition explains inheritance →
Practices of the Python Pro
Inheritance is an object-oriented mechanism by which a class derives or reuses behavior and structure from one or more other classes.
- How it is used
- Uses inheritance to model true is-a relationships and specialize behavior, while reserving composition for has-a relationships and reusable behavior.
- How deep it goes
- Explains hierarchy risks, design rules, Python inspection, multiple inheritance, method resolution order, and abstract base classes.
- Examples
- Demonstrates inheritance with bicycle components, bird subclasses, command classes, mixins, and contrasting hierarchy diagrams.
- What you can do after
- Apply inheritance selectively, specialize superclass behavior, combine it with composition, and inspect or test Python hierarchies.
The Well-Grounded Python Developer: How the pros use Python and Flask
Inheritance is an object-oriented programming mechanism in which a class derives attributes and behavior from another class.
- How it is used
- Uses inheritance to share shape attributes and behavior while letting individual shapes define their own features.
- How deep it goes
- Explains parent–child terminology and Python declaration syntax, then develops constructors and drawing methods through a shape hierarchy.
- Examples
- Builds on screen-drawn rectangles, squares, and circles, including a square initialized through its rectangle parent.
- What you can do after
- Build it from scratch by defining Python subclasses that reuse parent initialization and add shape-specific behavior.
Object-Oriented Software Design in C++
Inheritance is a language mechanism by which a subclass derives state and behavior from a superclass and may extend or override them.
- How it is used
- Models is-a relationships and structures reusable object-oriented designs before choosing between inheritance and composition.
- How deep it goes
- Defines superclass inheritance, subclass extension, and overriding, then examines duplication, hardcoded behavior, and Template Method trade-offs.
- Examples
- Uses Book subclasses, Toy subclasses, UML generalization diagrams, and configurable play and sound behavior classes.
- What you can do after
- Evaluate inheritance designs, identify duplication and hardcoded behavior, and refactor variable behavior toward composition in C++.
Read how Object-Oriented Software Design in C++ explains inheritance →
Web Components in Action
- How it is used
- Connects familiar DOM elements to HTMLElement and shows how subclasses can share component behavior.
- How deep it goes
- Defines inheritance through an animal analogy, then demonstrates DOM class relationships, component subclassing, and CSS custom-property inheritance.
- Examples
- Uses animal classes, familiar DOM elements, a frame-updating countdown component, and scoped text-color variables.
- What you can do after
- Build component subclasses that reuse a base class’s frame-update behavior and customize its update method.
The Well-Grounded Rubyist, Fourth Edition
Class inheritance is the Ruby mechanism by which a class derives behavior and structure from another class.
- How it is used
- Uses superclass–subclass relationships to share instance methods and model more specific kinds of objects.
- How deep it goes
- Explains declaration syntax, inherited methods, ancestry, single inheritance, and method lookup; leaves fuller module treatment beyond the initial class hierarchy.
- Examples
- Shows Publication, Magazine, and Ezine sharing attributes, then contrasts a CargoHold subclass with a module-based design.
- What you can do after
- Build it from scratch with `<`, then evaluate whether a superclass or module better supplies shared behavior.
Read how The Well-Grounded Rubyist, Fourth Edition explains inheritance →
Python How-To
Class inheritance is a Python object-model feature in which a class derives attributes and behavior from one or more other classes.
- How it is used
- Reduces repeated attributes and methods across related data models while allowing subclass-specific behavior.
- How deep it goes
- Demonstrates subclass syntax and automatic method inheritance, then covers data-class field ordering and superclass-aware type checks.
- Examples
- Uses an employee and supervisor hierarchy, inherited bill fields, and a card-sorting int subclass.
- What you can do after
- Build it from scratch by extracting a shared superclass and defining subclasses that inherit its initializer and methods.
Software Design for Python Programmers
Inheritance is an object-oriented mechanism through which a subclass derives state and behavior from a superclass.
- How it is used
- Uses inheritance to organize shared state and behavior while evaluating whether subclass hierarchies improve application design.
- How deep it goes
- Defines superclass and subclass inheritance, then examines duplication, hardcoding, overriding, composition, and design-pattern tradeoffs.
- Examples
- Demonstrates inheritance with book-catalogue classes, toy subclasses, and sports subclasses for players and venues.
- What you can do after
- Evaluate inheritance against composition and select a hierarchy or pattern that limits duplication, coupling, and hardcoded behavior.
Read how Software Design for Python Programmers explains inheritance →
Secrets of the JavaScript Ninja, Second Edition
A reuse relationship in which one object or type can access properties or behavior defined by another through a hierarchical relationship.
- How it is used
- Uses inheritance to reuse object properties and methods without repeating code or data.
- How deep it goes
- Works through prototype lookup, failed method copying, constructor-chain setup, and ES6 syntax, including the older approach’s constructor-property repair.
- Examples
- Contrasts copied dance methods with a prototype chain, then checks Person and Ninja instances created with ES6 classes.
- What you can do after
- Build it from scratch with constructor prototypes or apply it via ES6 extends and super, then check the relationship with instanceof.
Read how Secrets of the JavaScript Ninja, Second Edition explains inheritance →
CSS in Depth, Second Edition
An inherited property is a CSS property whose value is passed from an element to its descendants when they do not have their own cascaded value.
- How it is used
- Uses inheritance to share styles across descendants while distinguishing inherited values from values assigned by the cascade.
- How deep it goes
- Explains which properties commonly inherit, how overrides work, and how keywords alter the result, without attempting a comprehensive property list.
- Examples
- Uses a body font, a gray footer link, a font shorthand conflict, and panels inside different color contexts.
- What you can do after
- Diagnose/debug with inheritance by tracing parent values, descendant overrides, and shorthand declarations; apply `inherit` when a link should follow its parent.
Read how CSS in Depth, Second Edition explains inheritance →
Essential TypeScript 5, Third Edition
Class inheritance is a mechanism by which one class derives features from a superclass.
- How it is used
- Uses inheritance to share class features while specializing subclasses and to examine how TypeScript types collections of related objects.
- How deep it goes
- Works through prototype lookup, superclass construction, method overrides, and subclass-array inference, including a failed inference assumption and an explicit annotation.
- Examples
- Uses a taxed product overriding `toString` and employee, customer, and supplier subclasses placed in a typed array.
- What you can do after
- Build it from scratch with `extends` and `super`, then annotate a shared-superclass array when inference yields a narrower union.
Read how Essential TypeScript 5, Third Edition explains inheritance →
Data-Oriented Programming: Reduce software complexity
Class inheritance is a language mechanism in which a class derives behavior and structure from one or more parent classes.
- How it is used
- Uses parent classes to reuse common behavior and structure in object-oriented system designs.
- How deep it goes
- Explains inheritance through UML notation and a changing library requirement, but stops short of implementation details.
- Examples
- Uses User, Member, Librarian, VIPMember, login behavior, and adding book items as concrete design examples.
- What you can do after
- Evaluate how a new requirement may increase class-hierarchy complexity when behavior is locked inside methods.
Read how Data-Oriented Programming: Reduce software complexity explains inheritance →
Web Design Playground
- How it is used
- Clarifies why CSS styles spread through element families and interact with competing declarations.
- How deep it goes
- Defines parent-to-descendant propagation, distinguishes inherited properties, and works through nested em calculations.
- Examples
- Uses an intro div with nested inline elements and a body-header-h1 em sizing chain.
- What you can do after
- Diagnose/debug with it by tracing inherited styles and calculating nested em font sizes.
Kotlin in Action, 2E
Inheritance is the language mechanism by which a class derives members and behavior from a superclass.
- How it is used
- Uses inheritance to define controlled Kotlin class hierarchies while protecting members not intended for extension.
- How deep it goes
- Explains open, final, override, and abstract members with examples, stopping short of broader inheritance design guidance.
- Examples
- Uses Clickable, Button, RichButton, ThemedButton, and conflicting default interface methods to demonstrate inheritance behavior.
- What you can do after
- Apply it via Kotlin's open, override, final, and abstract modifiers to build selectively extensible class hierarchies.
Clojure: The Essential Reference
Concrete inheritance is an object-oriented mechanism in which a concrete class inherits implementation from another concrete class.
- How it is used
- Positions concrete inheritance as a Java-interoperability concern while rejecting it in Clojure's object-oriented model.
- How deep it goes
- Contrasts Clojure's prohibition with Java-oriented extension points but stops short of inheritance mechanics or dispatch internals.
- Examples
- Uses gen-class, proxy, reify, deftype, defrecord, and defprotocol as contrasting type and polymorphism mechanisms.
- What you can do after
- Evaluate whether Java class extension, records, or protocol-based dispatch fits a Clojure design.
Read how Clojure: The Essential Reference explains inheritance →
The Joy of JavaScript
A code-reuse relationship in which one object or construct acquires or specializes behavior and data from another.
- How it is used
- Uses inheritance to model specialized transaction objects while comparing prototype, class, and module-based reuse.
- How deep it goes
- Traces prototype links, constructor calls, property lookup, encapsulation, and prototype pollution through worked JavaScript examples.
- Examples
- Uses Transaction and HashTransaction implementations, prototype listings, util.inherits, private fee fields, and module-pattern construction.
- What you can do after
- Builds inheritance with constructor functions or class and extends, and evaluates tradeoffs involving boilerplate, sharing, and encapsulation.
Related concepts
- compositioncontrasts with · Composition is a technique for combining simpler functions, components, or operations into a larger structure or behavior.
- object-oriented programmingpart of · Object-oriented programming is a programming paradigm that organizes software around objects combining state and behavior, commonly using encapsulation, classes, inheritance, or polymorphism.
- inheriteduses · inherited is a Ruby class method callback invoked on a class when that class is subclassed, receiving the new subclass as its argument.
- classkind of · A class is a programming-language construct that defines a type’s structure or behavior and provides a basis for creating or representing objects.
- superclassuses · A superclass is a class from which another class inherits members, structure, state, or behavior.
- multiple inheritanceincludes · Multiple inheritance is an object-oriented inheritance model in which a class or type directly derives attributes or behavior from more than one parent.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


















