本帖最后由 bjfanxc 于 2014-3-27 14:08 编辑
- ackage com.itheima;
- public class Test2 {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- }
- }
- //员工类
- class Worker{
- private String name;
- private Long id;//这里的属性应该定义成什么类型好?
- private Double pay;
- Worker(String name,Long id,Double pay){
- this.name = name;
- this.id = id;
- this.pay = pay;
- }
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
- public Double getPay() {
- return pay;
- }
- public void setPay(Double pay) {
- this.pay = pay;
- }
- }
- //经理类
- class Manager extends Worker{
-
- private Double bonus;
- Manager(String name, Long id, Double pay) {
- super(name, id, pay);
- }
-
- public Double getBonus() {
- return bonus;
- }
- public void setBonus(Double bonus) {
- this.bonus = bonus;
- }
- }
复制代码
|