Decorator பேட்டர்ன் அசল வகுப்பைத் திருத்தாமல், பொருள்களை மூடி வைப்பதன் மூலம் நடத்தை அல்லது பொறுப்புகளை ديناميकமாக சேர்க்கிறது — இது செயல்பாடு விரிவுபடுத்த subclassing க்கு ஒரு நমनीய மாற்றாகவும், நடத்தைகளை இணைக்கவும் உங்களுக்கு உதவுகிறது.
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
