We want to specify the rest of the behavior
- It will then remain the responsibility of a subclass to
implement that behavior
abstract class Employee {
Employee(Name name, String ssNum) {...}
...
abstract void doPayroll();
...
Name name;
String ssNum;
Date hiredOn;
}
class FactoryWorker extends Employee {
FactoryWorker(Name name, String ssNum, Currency hourlyRate) {
super(name, ssNUm);
this.hourlyRate = hourlyRate;
}
...
void doPayroll() {
...
}
...
...
double hourlyRate;
}
class OfficeWorker extends Employee {
OfficeWorker(Name name, String ssNum, Currency annualSalary) {
super(name, ssNUm);
this.annualSalary = annualSalary;
}
...
void doPayroll() {
...
}
...
Currency annualSalary;
}