Skip to content

Commit 5836fdb

Browse files
authored
Merge pull request iluwatar#632 from OCNYang/master
Delete duplicate declared objects:ClubbedTroll
2 parents 2e90f82 + 6a560f7 commit 5836fdb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

decorator/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ troll.attack(); // The troll tries to grab you!
105105
troll.fleeBattle(); // The troll shrieks in horror and runs away!
106106
107107
// change the behavior of the simple troll by adding a decorator
108-
Troll clubbed = new ClubbedTroll(troll);
109-
clubbed.attack(); // The troll tries to grab you! The troll swings at you with a club!
110-
clubbed.fleeBattle(); // The troll shrieks in horror and runs away!
108+
troll = new ClubbedTroll(troll);
109+
troll.attack(); // The troll tries to grab you! The troll swings at you with a club!
110+
troll.fleeBattle(); // The troll shrieks in horror and runs away!
111111
```
112112

113113
## Applicability

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public static void main(String[] args) {
5757

5858
// change the behavior of the simple troll by adding a decorator
5959
LOGGER.info("A troll with huge club surprises you.");
60-
Troll clubbed = new ClubbedTroll(troll);
61-
clubbed.attack();
62-
clubbed.fleeBattle();
63-
LOGGER.info("Clubbed troll power {}.\n", clubbed.getAttackPower());
60+
troll = new ClubbedTroll(troll);
61+
troll.attack();
62+
troll.fleeBattle();
63+
LOGGER.info("Clubbed troll power {}.\n", troll.getAttackPower());
6464
}
6565
}

0 commit comments

Comments
 (0)