Design Patterns · Senior · Question 46 of 75
What's the difference between "implementation inheritance" and "interface inheritance"?
- ✓Correct answer: The first takes the parent's code, the second only the contract
- 2The first works only in TypeScript, the second only in JavaScript
- 3They're the same thing; only the syntax differs
Explanation
A class's extends pulls in the implementation and creates strong coupling to the parent. implements or structural typing define only the contract. Most "composition over inheritance" advice is specifically about implementation inheritance.