Mid SOLID

How does the Strategy pattern promote Open/Closed Principle?

It promotes the Open/Closed Principle by allowing you to add new strategies (algorithms

or behaviors) without modifying the existing code.

The context class uses an interface for the strategy, so new behavior can be added just by

creating a new class that implements the interface—no need to touch existing logic.

More from Design Patterns in C#

All questions for this course