+ 11
Is not that clear with the decorator? I slightly changed the code for a better understanding.
2 Answers
+ 3
Here is an example of what a decorator may be useful for:
https://code.sololearn.com/cD09ijlIS6Ev/?ref=app
+ 2
Are you trying to use the decorator design pattern? The decorator must be like a component to the class. Look online for pseudo code and more explanation on the design pattern.