liveBook · Manning

Override

Also called method overriding

Overriding is defining a more specific implementation of an inherited or otherwise replaceable operation so that it supplies behavior for a derived type or object.

How 3 Manning books explain it

Kotlin in Action, 2E

Method overriding is the definition of a subclass member function that replaces an inherited implementation with the same signature.

How it is used
Marks intentional replacements of inherited functions and properties while implementing interfaces or specializing subclasses.
How deep it goes
Explains open and final eligibility, runtime dispatch, interface conflicts, property implementations, and extension-function limits.
Examples
Uses View and Button clicks, competing Clickable and Focusable defaults, user nickname properties, Customer equality, and Point equality.
What you can do after
Apply it to implement interface contracts, specialize explicitly open members, resolve default-method conflicts, and customize object behavior.

Read how Kotlin in Action, 2E explains override →

Software Design for Python Programmers

Method overriding is the definition of a subclass method with the same operation interface as an inherited superclass method, causing the subclass implementation to be selected for subclass instances.

How it is used
Uses overriding to give subclass instances related behavior while preserving a common superclass interface.
How deep it goes
Explains signatures, runtime dispatch, super(), type-hint hazards, and contract concerns without descending into language-runtime internals.
Examples
Demonstrates Item and OrganicItem pricing, then exposes an incompatible operate() override through a TypeError.
What you can do after
Apply it via Python subclass methods, reuse superclass behavior with super(), and diagnose incompatible overrides using runtime failures and type checking.

Read how Software Design for Python Programmers explains override →

Python How-To

Method overriding is the object-oriented technique in which a subclass defines a method with the same name as an inherited method to provide a specialized implementation.

How it is used
Customizes inherited behavior for specialized subclasses and produces meaningful string representations for class instances.
How deep it goes
Defines complete and partial overrides, demonstrates __str__, and traces single-superclass lookup through method resolution order.
Examples
Uses Task.__str__, Supervisor.login, Supervisor.logout, super(), and Class.mro() as concrete demonstrations.
What you can do after
Apply overriding to replace or extend inherited methods and customize printed representations in Python classes.

Read how Python How-To explains override →

Also covered in

What to know first

Related concepts

Questions about override

What is override?

Overriding is defining a more specific implementation of an inherited or otherwise replaceable operation so that it supplies behavior for a derived type or object.

Which Manning books explain override?

Kotlin in Action, 2E, Software Design for Python Programmers and Python How-To.

What should I know before learning override?

Manning books that teach override usually introduce superclass, attribute, inheritance and method first.

What is override a kind of?

Override is a kind of contextual keyword. A contextual keyword is a C++ token treated as a reserved keyword only in specified syntactic contexts and usable as an identifier elsewhere.

What is override also called?

Override is also called method overriding.

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.