AI engineering glossary · Python advanced

What is method overriding?

Method overriding: Defining a method in a subclass with the same name as one in its parent, so the subclass version runs instead. It lets specialised classes change behaviour while keeping the same calling interface.

Level: intermediateTopic: Python advanced

Method overriding: an example

If Shape.area() raises an error, Circle defines its own area() returning 3.14159 * r ** 2, and calls to circle.area() use that.

Related terms

More Python advanced terms

Where you learn it

Method overriding is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.