我正在做一个项目,我有 3 个不同的类创建对象 CommissionEmployee、SalriedEmployee 和 HourlyEmployee。我需要将这些添加到主类中的数组列表中,但不确定我哪里出错了。
公共类公司{
public String companyName;
public SalariedEmployee owner;
public ArrayList<SalariedEmployee> salariedEmployee;
public ArrayList<HourlyEmployee> hourlyEmployee;
public ArrayList<CommissionEmployee> commissionEmployee;
public Company (String companyName, SalariedEmployee owner){
this.companyName = companyName;
this.owner = owner;
}
public void addSalariedEmployee (SalariedEmployee SalariedEmployee){
salariedEmployee.add(SalariedEmployee); **
}
public void addHourlyEmployee (HourlyEmployee HourlyEmployee){
//HourlyEmployee = new HourlyEmployee (name, position, ratePerHour);
hourlyEmployee.add(HourlyEmployee);
}
public void addCommissionEmployee (CommissionEmployee CommissionEmployee){
//CommissionEmployee = new CommissionEmployee (,, ratePerItem);
commissionEmployee.add(CommissionEmployee);
}
** = 这是我的编辑告诉我我出错的那一行。干杯,任何帮助将不胜感激