Bird
Raised Fist0

Why might using an abstract class instead of an interface limit flexibility in a large-scale system design?

medium🪤 Complexity Trap Q13 of Q15
OOP & Design Patterns - Abstraction - Abstract Class vs Interface - When to Use Which
Why might using an abstract class instead of an interface limit flexibility in a large-scale system design?
ABecause abstract classes do not support polymorphism.
BBecause abstract classes cannot define method signatures without implementation.
CBecause a class can only extend one abstract class but can implement multiple interfaces.
DBecause abstract classes force all methods to be implemented immediately.
Step-by-Step Solution
  1. Step 1: Recall inheritance limitations

    Most languages allow single inheritance of classes, limiting abstract class extension to one per class.
  2. Step 2: Interface multiple implementation

    Classes can implement multiple interfaces, allowing flexible contracts from various sources.
  3. Step 3: Why other options are incorrect

    Abstract classes can define abstract methods (method signatures), support polymorphism, and do not force immediate implementation if abstract.
  4. Final Answer:

    Option C -> Option C
  5. Quick Check:

    Single inheritance limits abstract class use; interfaces allow multiple contracts.
Quick Trick: Abstract classes limit inheritance; interfaces allow multiple implementations.
Common Mistakes:
MISTAKES
  • Believing abstract classes cannot have abstract methods.
  • Thinking abstract classes do not support polymorphism.
  • Assuming abstract classes force immediate method implementation.
Trap Explanation:
PITFALL
  • Options A, C, and D reflect misunderstandings about abstract classes' capabilities and language features.
Interviewer Note:
CONTEXT
  • Tests knowledge of trade-offs and limitations between abstract classes and interfaces.
Master "Abstraction - Abstract Class vs Interface - When to Use Which" in OOP & Design Patterns

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More OOP & Design Patterns Quizzes