Decorator పాటర్న్ వస్తువులను చుట్టడం (wrapping) ద్వారా అసలు క్లాస్ను సవరించకుండా ప్రవర్తన లేదా బాధ్యతలను డైనమిక్గా జోడిస్తుంది. ఇది ఫంక్షనాలిటీని విస్తరించడానికి సబ్క్లాసింగ్కు నమ్యమైన ప్రత్యామ్నాయాన్ని అందిస్తుంది, ఇది ప్రవర్తనలను కంపోజ్ చేయడానికి అనుమతిస్తుంది.
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
