Example: Now Suppose We Extend Employee Class As Follows
The document describes a Salary class that extends the Employee class. The Salary class adds a salary field and overrides the mailCheck method to print the salary when mailing a check. A main method creates a Salary object referenced as both a Salary and Employee, and calls mailCheck on each to demonstrate the polymorphic behavior.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
55 views2 pages
Example: Now Suppose We Extend Employee Class As Follows
The document describes a Salary class that extends the Employee class. The Salary class adds a salary field and overrides the mailCheck method to print the salary when mailing a check. A main method creates a Salary object referenced as both a Salary and Employee, and calls mailCheck on each to demonstrate the polymorphic behavior.