← Quiz: Design Patterns: all 10 questions
Quiz: Design Patterns · Question 8 of 10
paymentfactory("upi") returns a Upi object. What is the main benefit of this factory?
payment_factory("upi") returns a Upi object. What is the main benefit of this factory?
- A.It makes payments faster
- B.Calling code does not need to know which concrete class to create
- C.It guarantees only one payment object exists
- D.It notifies subscribers about payments
Answer & explanation
Correct answer: Calling code does not need to know which concrete class to create
The factory decides the class; callers just use the returned object.
Can you get the rest right without peeking?
Take the timed Quiz: Design Patterns quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →