The Artima Developer Community
Sponsored Link

Employee is-a Person

Advertisement

Advertisement

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 Artima Forums.

Message:

Employee is-a Person

Posted by Helge Bredow on 21 Oct 1998, 1:52 AM

I was intrigued by your statement that you may not necessarily model Employee as a subclass of Person, which is something I have always thought to be the case. How would you then pass an Employee to a method that expects a Person?

I suspect that Employee would have a contructor that takes a Person as an argument and would also have a method getPerson() which returns a reference to that person object. This solution seems a but ugly to me since you would really like to pass that Employee around the system as if it were a Person.



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us