- abstract class Employee
- {
- private String name;
- private String id;
- private double pay;
- Employee(String name,String id,double pay)
- {
- this.name = name;
- this.id = id;
- this.pay = pay;
- }
- public abstract void work();
- }
- class Manager extends Employee
- {
- private double bonus;
- Manager(String name,String id,double pay,double bonus)
- {
- super(name,id,pay);
- this.bonus = bonus;
- }
- public void work()
- {
- System.out.println("manage");
- }
- }
- class Programmer extends Employee
- {
- Programmer(String name,String id,double pay)
- {
- super(name,id,pay);
-
- }
- public void work()
- {
- System.out.println("code");
- }
- }
复制代码 问题是super(name,id,pay); this.bonus = bonus;这2句不是同一行了吗?为啥还是对的??
|