//父类 Employee表
package demo06;
import java.util.Date;
public class Employee {
private String name;
private int month;
public Employee() {
}
public Employee(String name, int month) {
this.name = name;
this.month = month;
}
public String getName() {
return name;
}
public int getMonth() {
return month;
}
public void setName(String name) {
this.name = name;
}
public void setMonth(int month) {
this.month = month;
}
public int getSalary(int month){
return 0;
}
}
//子类可以继承共享父类表的信息
package demo06;
import java.util.Date;
public class SalariedEmployee extends Employee { //拿固定工资的员工
private int yueXin;
public SalariedEmployee(int yueYin) {
this.yueXin = yueYin;
}
public SalariedEmployee(String name, int month, int yueXin) {
super(name, month);
this.yueXin = yueXin;
}
public int g
使用java用继承 封装来计算出某公司的雇员的工资
最新推荐文章于 2023-04-16 15:28:53 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)