overriding
Overriding is an object-oriented programming mechanism in which a subclass replaces a method it inherits from a superclass with its own implementation. The subclass receives the original method through inheritance and redefines it under the same name with a compatible signature.
When code calls that method on an object, the version that runs is chosen from the object’s actual class at run time, a behavior called dynamic dispatch. This makes overriding the engine behind subtype polymorphism, since code written against the superclass automatically picks up the subclass version.
To watch that selection happen, pick an object’s actual class below and follow dynamic dispatch as it climbs the inheritance chain to the first class that overrides the method.
An overriding method can also extend the original rather than fully replace it, calling the superclass version through a construct such as super(). Different languages mark the relationship in their own way. C++ dispatches dynamically only for methods declared virtual, Java provides the @Override annotation as a compile-time safety check, and Python makes every method overridable by default.
In Python, that mechanism is known as method overriding. Overriding is distinct from overloading, where one name instead maps to several methods that differ in their parameters.
Related Resources
Course
Inheritance and Internals: Object-Oriented Programming in Python
In this video course, you'll learn about the various types of inheritance that you can use to write object-oriented code in Python. These include class inheritance, multilevel inheritance, and multiple inheritance, along with special methods and abstract base classes.
For additional information on related topics, take a look at the following resources:
- Object-Oriented Programming (OOP) in Python (Tutorial)
- Object-Oriented Programming in Python vs Java (Tutorial)
- Inheritance and Composition: A Python OOP Guide (Tutorial)
- Custom Python Dictionaries: Inheriting From dict vs UserDict (Tutorial)
- Custom Python Lists: Inheriting From list vs UserList (Tutorial)
- Custom Python Strings: Inheriting From str vs UserString (Tutorial)
- A Conceptual Primer on OOP in Python (Course)
- Intro to Object-Oriented Programming (OOP) in Python (Course)
- Object-Oriented Programming (OOP) in Python (Quiz)
- Python vs Java: Object Oriented Programming (Course)
- Inheritance and Composition: A Python OOP Guide (Course)
- Inheritance and Composition: A Python OOP Guide (Quiz)
By Martin Breuss • Updated Sept. 3, 2026