|
-
Dec 18th, 2003, 08:32 AM
#1
Thread Starter
Frenzied Member
How to implement collection the OO way
OK, I have an UML class dragram where I have CCustomer, CItem, CBasket
This is for a true UML-OO webshop in ASP.NET
Anyway the relationship is 1->n for the Basket and the Item, meaning one basket can contain multiple items
BUT
how do I implement this code wise? I need only one basket object, but how and where do I create the items (I know about factory/abstract factory patterns) and how do I store them in the basket object?
Should the basket inherit som arraylist or collection class?
I want to perform some basic MyBasket.Add(Item as CItem)
There are no child classes for the item object, since all items in the shop share the same functionality.
My two questions are:
1) What pattern should I use when I create the items??
2)How should I add them to the basket???
Some code or UML would be nice. Im currently in the Class diagram phase of the project
thanks
Henrik
ps I prefer a GOF pattern solution to the problem ds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|