Bird
0
0

Which component in the Payment Strategy Pattern is responsible for defining the common interface for all payment methods?

easy📝 Conceptual Q2 of 15
LLD - Design — Online Shopping Cart
Which component in the Payment Strategy Pattern is responsible for defining the common interface for all payment methods?
AContext
BConcrete Strategy
CClient
DStrategy Interface
Step-by-Step Solution
Solution:
  1. Step 1: Identify the role of each component

    The Strategy Interface defines the common methods all payment strategies must implement.
  2. Step 2: Differentiate from other components

    Context uses the strategy, Concrete Strategy implements it, Client uses Context, but only Strategy Interface defines the contract.
  3. Final Answer:

    Strategy Interface -> Option D
  4. Quick Check:

    Common interface = Strategy Interface [OK]
Quick Trick: Interface defines common methods for all strategies [OK]
Common Mistakes:
  • Confusing Context with interface
  • Thinking Concrete Strategy defines interface
  • Assuming Client defines methods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes