mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 14:16:02 +00:00
- Assign ClubberTroll to another variable in README
This commit is contained in:
1 parent
86e9c66ca5
commit
b3f0cc7e00
1 file changed
+3
-3
+3
-3
@@ -104,9 +104,9 @@ troll.attack(); // The troll tries to grab you!
|
|||||||
troll.fleeBattle(); // The troll shrieks in horror and runs away!
|
troll.fleeBattle(); // The troll shrieks in horror and runs away!
|
||||||
|
|
||||||
// change the behavior of the simple troll by adding a decorator
|
// change the behavior of the simple troll by adding a decorator
|
||||||
troll = new ClubbedTroll(troll);
|
Troll clubbedTroll = new ClubbedTroll(troll);
|
||||||
troll.attack(); // The troll tries to grab you! The troll swings at you with a club!
|
clubbedTroll.attack(); // The troll tries to grab you! The troll swings at you with a club!
|
||||||
troll.fleeBattle(); // The troll shrieks in horror and runs away!
|
clubbedTroll.fleeBattle(); // The troll shrieks in horror and runs away!
|
||||||
```
|
```
|
||||||
|
|
||||||
## Applicability
|
## Applicability
|
||||||
|
|||||||
Reference in new issue
Block a user