Results 1 to 4 of 4
Thread: Simple Inheritance issue...
- 07-27-2009, 07:02 PM #1
Member
- Join Date
- Jul 2009
- Posts
- 1
- Rep Power
- 0
Simple Inheritance issue...
Hello,
I’m in a bit of a pickle !
I have an abstract Event object with a number of obvious instance variables like name, description, start, end, creator etc.. This class also has a participant list under the form of a List<User>. So far so good. I have also made a FancyDressParty subclass of Event. In the context of a fancy party I’d like to add some context to each participant such as the Costumes they are wearing however I can’t see a way to do this elegantly without ending up with duplicate User lists (the List<User> inherited from Event and the FancyDressParty’s Map<User, Costume>).
Any ideas?
Many Thanks,
- 07-27-2009, 07:42 PM #2
Member
- Join Date
- Sep 2008
- Posts
- 13
- Rep Power
- 0
Have you tried specifically designated which level of inheritance using "super"? So let me get this straight, you try to add some context to each user element inside ur abstract class's list but end up duplicate user lists? Meaning that List<User> information is wrongfully aligned with FancyDressParty's Map<User, Costume>?
- 07-27-2009, 07:47 PM #3
Senior Member
- Join Date
- Sep 2008
- Posts
- 564
- Rep Power
- 5
What would be best is to create a subclass of "User" for each subclass of "Event".
-
Would the Decorator design pattern used on the User be applicable here?
Per Wikipedia, the decorator pattern is a design pattern that allows new/additional behaviour to be added to an existing class dynamically.Last edited by Fubarable; 07-27-2009 at 10:41 PM.
Similar Threads
-
Inheritance example
By kris4u4ever in forum New To JavaReplies: 3Last Post: 03-21-2009, 02:53 PM -
inheritance
By itaipee in forum New To JavaReplies: 6Last Post: 01-20-2009, 08:18 PM -
inheritance basic.
By newmember in forum New To JavaReplies: 1Last Post: 08-02-2008, 09:35 PM -
Inheritance
By mew in forum New To JavaReplies: 1Last Post: 12-07-2007, 06:08 PM -
Inheritance in GUI
By Marty in forum SWT / JFaceReplies: 2Last Post: 05-11-2007, 12:54 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks