day11-类作为成员变量类型(hero,weapon,armor)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.inmind.class_interface04;
|
||||
|
||||
//武器类
|
||||
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