I came across this article: http://ift.tt/1CrtqLD
After reading it, I am having a little bit of difficulty understanding a concept. If you look in the Structure section in that article when it shows the UML class diagram, I am confused on why the Option Wrapper class extends the Interface class but the Option Wrapper class has an instance (composition) of the Interface class as well. Why are both of these relationships needed to in order to accomplish what the Decorator Pattern hopes to do? In other words, why is neither relationship good enough by its self?
Aucun commentaire:
Enregistrer un commentaire