day11--引用类型作为成员变量类型(hero,weapon,armor,skill)

This commit is contained in:
xx
2026-10-10 10:44:56 +08:00
parent 025c5652e3
commit 75d957d433
5 changed files with 183 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package com.inmind.test05;
//装备类
public class Armor {
//名称
private String name;
//防御值
private int protectedNum;
public Armor(String name, int protectedNum) {
this.name = name;
this.protectedNum = protectedNum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getProtectedNum() {
return protectedNum;
}
public void setProtectedNum(int protectedNum) {
this.protectedNum = protectedNum;
}
}