|
|
|
|
Now you can give all Employees (including Managers) a raise:
Note that we can write: staff[2] = new Manager("Mother Theresa",
120000,
new Date(89, 3, 5),
"Demi Moore" // Secretary name
);
even though staff[2] is of type Employee, because we declared the class Manager as extending from Employee -- that is, a Manager is a kind of Employee. Question: Would the following be legal/valid?
Manager bill = new Employee("Bill Gates",
20000000.00,
new Date(85, 1, 1));
When the above program is run, it produces the following output: Charlie Chaplin 35700.0 1978 Florence Nightingale 105.0 1971 Mother Theresa 133800.0 1989 |
|
This page was last modified on 02 October, 2007 |