Update App.java
The relationship between decorator and target (in the code example between Troll und SmartTroll) ist not a composition as described in the code comment lines of class App. It's a aggregation. In a composition both instances canncot live without the other one. But the target (Troll) could live without the decorator (Smart Troll). Changed "composition" to "aggregation" in the comment lines. Code lines are unchanged. Greetings Thomas
This commit is contained in:
parent
e1ae1067db
commit
9180bb0fef
@ -25,7 +25,7 @@ package com.iluwatar.decorator;
|
||||
/**
|
||||
*
|
||||
* The Decorator pattern is a more flexible alternative to subclassing. The Decorator class
|
||||
* implements the same interface as the target and uses composition to "decorate" calls to the
|
||||
* implements the same interface as the target and uses aggregation to "decorate" calls to the
|
||||
* target. Using the Decorator pattern it is possible to change the behavior of the class during
|
||||
* runtime.
|
||||
* <p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user