Mid
From PDF
GoF Patterns
Gang of Four Patterns
Concrete Implementations:?
Short answer: The DrawingAPI1 and DrawingAPI2 are concrete implementations of the IDrawingAPI interface. These classes implement the specific drawing logic for rendering circles, but they could use different libraries or methods (e.g., OpenGL, DirectX, Canvas API). public class DrawingAPI1 : IDrawingAPI
Example code
{
public void DrawCircle(double x, double y, double radius) => Console.WriteLine($"Drawing Circle at ({x}, {y}) with radius {radius} using API 1."); }
public class DrawingAPI2 : IDrawingAPI
{
public void DrawCircle(double x, double y, double radius) => Console.WriteLine($"Drawing Circle at ({x}, {y}) with radius {radius} using API 2."); }
Say this in the interview
- Define — one clear sentence (the short answer above).
- Example — relate it to a project like ShopNest or your real work.
- Trade-off — when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png