Decorator pattern yana ƙara jeri ko ayyuka ga abubuwa ta hanyar nannade su — ba tare da canja wurin original class ba. Yana ba da flexible madadin subclassing don fadada aiki, yana ba ka damar tsara jeri.
Menene Decorator pattern take
DECORATOR → WRAP an object to add behavior, keeping the same interface:
→ the decorator wraps the original, adds its behavior, and delegates to the original
→ you can STACK decorators (wrap a wrapped object) → compose multiple behaviors
→ adds functionality WITHOUT modifying the original class or using subclassing
→ "wrap to extend" — flexible, composable behavior addition
