ডেকোরেটর প্যাটার্ন গতিশীলভাবে বস্তুগুলিকে মোড়িয়ে — মূল ক্লাসকে পরিবর্তন না করে — আচরণ বা দায়িত্ব যোগ করে। এটি কার্যকারিতা প্রসারিত করার জন্য subclassing এর একটি নমনীয় বিকল্প প্রদান করে, যা আপনাকে আচরণগুলি সংযুক্ত করতে দেয়।
ডেকোরেটর প্যাটার্ন কী করে
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
