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.
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.
Also covered in
- Object-Oriented Software Design in C++
- The Well-Grounded Rubyist, Fourth Edition
- Learn C++ by Example
- 100 C++ Mistakes and How to Avoid Them
- Practices of the Python Pro
- Get Programming: Learn to code with Python
- The Quick Python Book, Fourth Edition
- Python Workout: 50 ten-minute exercises
- Pro ASP.NET Core 7, Tenth Edition
What to know first
- superclassA superclass is a class from which another class inherits members, structure, or behavior.
- attributeAn attribute is a named property or piece of information associated with an entity, object, or structured data item.
- inheritanceInheritance is a mechanism in which a derived type or descendant element receives properties or behavior from a parent, subject to rules that may allow specialization or overriding.
- methodA method is a callable function or operation associated with a type, class, or object and invoked through that association.
Related concepts
- inheritanceuses · Inheritance is a mechanism in which a derived type or descendant element receives properties or behavior from a parent, subject to rules that may allow specialization or overriding.
- C++produced by · C++ is a statically typed, general-purpose programming language that supports procedural, object-oriented, generic, and low-level systems programming.
- open modifierconfigured by · The open modifier is a Kotlin declaration modifier that permits a class to be subclassed or a member to be overridden.
- 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.
- polymorphismuses · Polymorphism is a programming-language capability that lets a common operation or interface work with values of different types, with behavior or implementation determined by the type or value.
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.


