**需求:**一个游戏角色案例,通过接口,实现游戏角色的职业、武器、伤害。
api接口类:
import com.ld.pojo.Equipment;
public interface Role {
public void kill();//击杀方法
public void buy(Equipment e);//购买装备方法
}
pojo装备类:
public class Equipment {
private String name;//武器名字
private int attackPower;//攻击力
private int money;//金币
public Equipment() {
}
public Equipment(String name, int attackPower, int money) {
this.name = name;
this.attackPower = attackPower;
this.money = money;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAttackPower() {
return attackPower;
}
public void setAttackPower(int attackPower) {
this.attackPower = attackPower;
}
public int getMoney() {
return money;
}
public void setMoney(int money) {
this.money = money;
}
}
pojo英雄类(父类):
public abstract class Hero {
private String name;//英雄的名字
private String profession;//英雄的职业
public Hero() {
}
public Hero(String name, String profession) {
this.name = name;
this.profession =</