day11--引用类型作为成员变量类型(hero,weapon,armor,skill)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.inmind.test05;
|
||||
|
||||
//武器类
|
||||
public class Weapon {
|
||||
//名称
|
||||
private String name;
|
||||
//伤害值
|
||||
private int hurt;
|
||||
|
||||
public Weapon(String name, int hurt) {
|
||||
this.name = name;
|
||||
this.hurt = hurt;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getHurt() {
|
||||
return hurt;
|
||||
}
|
||||
|
||||
public void setHurt(int hurt) {
|
||||
this.hurt = hurt;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user