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.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
39 views
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.