Delete duplicate declared objects:ClubbedTroll
Trolls should not be re-declared: if I had a troll called Zac, one day I gave him a weapon.I can not because he now has a weapon called him Trundle. He is still Zac.
This commit is contained in:
@ -105,9 +105,9 @@ troll.attack(); // The troll tries to grab you!
|
||||
troll.fleeBattle(); // The troll shrieks in horror and runs away!
|
||||
|
||||
// change the behavior of the simple troll by adding a decorator
|
||||
Troll clubbed = new ClubbedTroll(troll);
|
||||
clubbed.attack(); // The troll tries to grab you! The troll swings at you with a club!
|
||||
clubbed.fleeBattle(); // The troll shrieks in horror and runs away!
|
||||
troll = new ClubbedTroll(troll);
|
||||
troll.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!
|
||||
```
|
||||
|
||||
## Applicability
|
||||
|
Reference in New Issue
Block a user