Reviewed by Aditya Kumar · Last reviewed 2026-03-24
**Inheritance:** Class extends another; inherits fields/methods. `class Dog extends Animal`. **Polymorphism:** Supertype reference → subtype; runtime dispatch. `Animal a = new Dog(); a.eat()` calls Dog's override. **Why:** Extensibility; Liskov Substitution. **Trade-off:**...
Pro-Move: Liskov + composition over inheritance. Red Flag: Deep inheritance hierarchies.
Inheritance: Class extends another; inherits fields/methods. class Dog extends Animal. Polymorphism: Supertype reference → subtype; runtime dispatch. Animal a = new Dog(); a.eat() calls Dog's override. Why: Extensibility; Liskov Substitution. Trade-off: Composition often > inheritance. Production: Interfaces for contracts. Scalability: Polymorphism enables plugin architectures.
Pro-Move: Liskov + composition over inheritance. Red Flag: Deep inheritance hierarchies.
According to DataEngPrep.tech, this is one of the most frequently asked Python/Coding interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.