Currently this is how I do my polymorphic assignments, manually, one by one:
Eg:
employees[ 0 ] = new salariedEmployee();
employees[ 1 ] = new salariedEmployee();
employees[ 2 ] = new commissionEmployee();
employees[ 3 ] = new hourlyEmployee();
How do you assign it more efficiently? Let's say you have to make 20 assignments?
Try this.
employee[] employees = {
new salariedEmployee(),
new salariedEmployee(),
new commissionEmployee(),
new hourlyEmployee(),
};