Question
Which statement about Abstract Base Classes vs Protocols is the strongest interview answer?
- Abstract Base Classes vs Protocols is mostly a naming style choice and has little effect on runtime behavior or design tradeoffs.
- Abstract Base Classes vs Protocols exists mainly to reduce the number of files in a Python project.
- Abstract Base Classes vs Protocols matters only for frontend scripting and not for backend or automation code.
- Abstract base classes model explicit inheritance contracts, while protocols model behavior-based compatibility through structural typing.
Hint
Start with the core rule behind Abstract Base Classes vs Protocols.
Answer and rationale
Correct answer: D. Abstract base classes model explicit inheritance contracts, while protocols model behavior-based compatibility through structural typing.
Abstract base classes model explicit inheritance contracts, while protocols model behavior-based compatibility through structural typing. This is the base concept interviewers commonly test first.
Track: Python