Mid From PDF GoF Patterns Gang of Four Patterns

Concrete Handlers:?

Short answer: The InfoLogger and ErrorLogger are concrete handlers that implement the Logger class.

Explain a bit more

Each handler checks if it can handle a particular log level (e.g., Info or Error). If it can, it processes the log; otherwise, it passes it along to the next handler in the chain. public class InfoLogger : Logger { protected override bool CanHandle(LogLevel level) => level == LogLevel.Info; protected override void Handle(string message) => Console.WriteLine($"Info: {message}"); }

Example code

public class ErrorLogger : Logger
{ protected override bool CanHandle(LogLevel level) => level == LogLevel.Error; protected override void Handle(string message) => Console.WriteLine($"Error: {message}"); }

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details