aspose file tools*
The moose likes Java in General and the fly likes Serious brain fart right now Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Serious brain fart right now" Watch "Serious brain fart right now" New topic
Author

Serious brain fart right now

Mark Fabrizio
Greenhorn

Joined: Mar 31, 2003
Posts: 7
I'm having a Design issue here. I want to have an object Person (or an interface, depending) be a base class. I then want to allow another class, Dealer, to extend or implement Person. I also want a class called Salesman to extend or implement Person.
For some reason, I can't think of a way that would allow a Person to be both a Dealer and a Salesman at the same time.
Any comments/help on this would be greatly appreciated.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9053
    
  12
Person has a Role of Salesman and/or Dealer?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Mark Fabrizio
Greenhorn

Joined: Mar 31, 2003
Posts: 7
yes,
A Person can exist by itself. A Dealer inherits all Person methods as does a Salesman. A Person could be a Salesman and a Dealer at the same time. But it could also just be a Salesman, or just a Dealer.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
If a person "has a" role (or multiple roles) instead of "is a" salesman or whatever, then there is no problem.
The roles would not necessarily extend person, they would just define job behaviors.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Mark Fabrizio
Greenhorn

Joined: Mar 31, 2003
Posts: 7
Thanks for your help,
I think I was trying to use inheritance for the wrong reasons.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Serious brain fart right now