⌘K
Flycodx

Factory and Abstract Factory Patterns

Factory and Abstract Factory Patterns

EasyLLD0% accepted

Implement Factory Method and Abstract Factory patterns. Use case: payment gateway that creates different payment processors (UPI, Card, NetBanking) based on payment type. Show how Abstract Factory creates families of related objects.

Approach

Implement Factory and Abstract Factory with payment gateway use case.

Input

PaymentFactory.createProcessor(PaymentType.UPI)

Output

Returns UpiProcessor implementing PaymentProcessor interface; client calls processor.charge(amount)

Scenarios & Expected Answers

Sign in to continue

Create a free account to view answers and mark progress.

  • Free forever — no credit card
  • Theory Q&A with detailed answers
  • Points, streaks & leaderboards
Auto Save On