day11-类作为成员变量类型(hero,weapon,armor)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package com.inmind.class_interface04;
|
||||
//防御装类
|
||||
public class Armor {
|
||||
private String name;//防御装的名字
|
||||
private int protectNum;//防御力
|
||||
|
||||
public Armor(String name, int protectNum) {
|
||||
this.name = name;
|
||||
this.protectNum = protectNum;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getProtectNum() {
|
||||
return protectNum;
|
||||
}
|
||||
|
||||
public void setProtectNum(int protectNum) {
|
||||
this.protectNum = protectNum;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user