| Next | February 2001 | Slide #28 |
Often two classes will have similar methods
For example, consider Person
It supports name, age, spouse methods
An Employee is a special kind of person
It supports all the same methods, but also department and boss
package Person; package Employee;
sub new { ... } (probably identical)
sub name { ... } (identical)
sub age { ... } (identical)
sub spouse { ... } (identical)
sub boss { ... }
sub department { ... }
Reimplementing identical methods in the Employee class is a waste
| Next | ![]() |
Copyright © 2001 M-J. Dominus |