strategy pattern

The strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

see SimUDuck app. for reference.

below you'll find a mess of classes and interface for an action adventure game.You'll find classes for game characters along with classes for weapon behaviors the characters can use int the game. Each character can make use of one weapon at a time, but can change weapons at any time during the game. Your job is to sort it all out...

Your task:
1 arrange the classes
2 Identify one abstract class, one interface and eight classes
3 Draw arrows between classes
a Draw this kind of arrow for inheritance ("extends"). ------|>
b Draw this kind of arrow for interface ("implements"). - - - - -|>
c Draw this kind of arrow for "HAS-A" --------->
4 put method setWeapon() into right class.

[IMG]http://i46.tinypic.com/2vug8ea.jpg[/IMG]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值