You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
563 B
22 lines
563 B
package w5挑战版;
|
|
|
|
// 老师
|
|
public class Teacher extends Person {
|
|
private String teacherId; // 工号
|
|
|
|
public Teacher(String name, int age, String teacherId) {
|
|
super(name, age);
|
|
this.teacherId = teacherId;
|
|
}
|
|
|
|
// 重写显示信息
|
|
@Override
|
|
public void showInfo() {
|
|
System.out.printf("【老师】%s | 年龄:%d | 工号:%s%n", getName(), getAge(), teacherId);
|
|
}
|
|
|
|
// 🔥 必须加这个getter!否则PersonManager里调用不到
|
|
public String getTeacherId() {
|
|
return teacherId;
|
|
}
|
|
}
|