Created
March 26, 2026 17:46
-
-
Save ahmed2m/afc5536799c24a5850662df10e30467e to your computer and use it in GitHub Desktop.
Decorator Pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CharDescription base = new CharName("Aragorn"); | |
| CharDescription decorated = | |
| new Who( | |
| new Wearing( | |
| new Granted( | |
| new Bearer( | |
| new Marked(base) | |
| ) | |
| ) | |
| ) | |
| ); | |
| decorated.getDescription(); | |
| // "Aragorn; Marked by destiny; Bearer of the Ring; Granted the kingship; Wearing the crown; Who is the rightful king" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment