Intermediate
C#
Q72 / 100
What is the Decorator pattern in C# and when would you use it?
Correct! Well done.
Incorrect.
The correct answer is B) Wrapping an object in another implementing the same interface to add behavior without modifying the original class
B
Correct Answer
Wrapping an object in another implementing the same interface to add behavior without modifying the original class
Explanation
class LoggingRepository : IRepository { IRepository _inner; ... } wraps an IRepository and adds logging. Enables Open/Closed Principle compliance.
Progress
72/100