This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Person-employee : Out of context
Posted by Herman Jansen on 03 Nov 1998, 3:23 AM
You really sould not discuss inheritance vs. composition but you
should discuss inheritance vs. composition-interfaces. Any other
way makes the discussion incomplete.
For all of you who want to read a very good text on inheritance
vs. composition-interfaces, specially on the person-employee
issue, please read the book : 'Java Design : Building better Apps
& Applets' by Peter Coad. There is a complete chapter on
inheritance vs. compositon-interfaces.
For the person-employee issue : An employee is not a special kind
of person, it is a normal person like you and me.
Employee is just a role you play in life as a person.
Therefor do not use inheritance.