Multiple choice technology architecture

What is a Decorator pattern?

  1. decouple an abstraction from its implementation so that the two can vary independently

  2. One class takes in another class, both of which extend the same abstract class, and adds functionality.

  3. Assembles group of objects with same signature

  4. One class controls the creation of and access to objects in another class.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The Decorator pattern attaches additional responsibilities to an object dynamically. It wraps an object (both implement the same interface) to add behavior without modifying the original class, providing a flexible alternative to subclassing for extending functionality.