Override
Overriding is defining a more specific implementation that replaces inherited behavior for a type or object while preserving the operation’s interface.
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.
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.
Related concepts
- inheritanceuses · 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.
- C++produced by · C++ is a statically typed, general-purpose programming language supporting procedural, object-oriented, generic, and low-level systems programming.
- pass-through changeimplemented by · Pass-through change is wrapping an existing method so that calls are forwarded to the original implementation while additional behavior is applied around it.
- open modifierconfigured by · The open modifier is a Kotlin declaration modifier that permits a class to be subclassed or a member to be overridden.
- polymorphismuses · Polymorphism is a programming-language capability that lets a common interface or operation work with values of different types while allowing behavior to vary by type or implementation.
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.


