Specifications

Sun Services
Java™ Programming Language
Module 6, slide 19 of 43
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Polymorphic Arguments
Because a Manager is an Employee, the following is valid:
public class TaxService {
public TaxRate findTaxRate(Employee e) {
// calculate the employee’s tax rate
}
}
// Meanwhile, elsewhere in the application class
TaxService taxSvc = new TaxService();
Manager m = new Manager();
TaxRate t = taxSvc.findTaxRate(m);