Decorator પેટર્ન વસ્તુઓને લપેટીને તેમમાં વર્તણૂક અથવા જવાબદારીઓ ગતિશીલ રીતે ઉમેરે છે — મૂળ વર્ગમાં ફેરફાર કર્યા વિના. તે કાર્યક્ષમતા વિસ્તૃત કરવા માટે સબક્લાસીંગને લવચીક વિકલ્પ આપે છે, જે તમને વર્તણૂકો રચવા દે છે.
Decorator પેટર્ન શું કરે છે
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
