Skip to content

Commit 9180bb0

Browse files
authored
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
1 parent e1ae106 commit 9180bb0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • decorator/src/main/java/com/iluwatar/decorator

decorator/src/main/java/com/iluwatar/decorator/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/**
2626
*
2727
* The Decorator pattern is a more flexible alternative to subclassing. The Decorator class
28-
* implements the same interface as the target and uses composition to "decorate" calls to the
28+
* implements the same interface as the target and uses aggregation to "decorate" calls to the
2929
* target. Using the Decorator pattern it is possible to change the behavior of the class during
3030
* runtime.
3131
* <p>

0 commit comments

Comments
 (0)