Inheritance

Domain: Programming Fundamentals

🎯 Motivation

When multiple classes share behaviour, inheritance lets a child class reuse a parent’s code without duplicating it.

đź“‹ Concrete Example

class Cat(Animal): - Cat inherits all of Animal’s methods. You can add cat-specific methods or override inherited ones.

đź”— Analogy

A family business - the child inherits the business knowledge and assets from the parent, then adds their own new ideas or changes some practices.