Thread: code problems
View Single Post
Old 03-17-2005, 08:30 AM   #7 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
What are the rows?
Quote:
During add_items function, need to add the number of items to this shelves.
Where? Do you or your teacher realize that the add_item() method belongs in the Shelf class?
I'll explain:
Object Orient programming is programming by behaviour, not by value. That means that a Shelf should manage it's own items.
And the Warehouse should manage it's own Shelves. All the Warehouse can do is restrict the amount of Shelves and Items on a Shelf.

So an array like: Warehouse[10][2] is a bad design.

Explaining is hard isn't it? Right now, you haven't got a clue how many interpretations I could have .
__________________
Valmont is offline   Reply With Quote