My inventory is a set length of 20 slots, and will be the only way a hero can carry items. This will not contain very super advanced awesome fun things like you'd find in WoW, I'm just looking for expanding my knowledge through practice.
That being said, does your statement still stand?
Which statement are you asking about? I read through all the posts, and all the advice is pretty solid. The item-that-contains-other-items would be good for a full game, but might be overkill for your purposes.
Originally Posted by Dark
If you have an inventory of 20 items, each one is going to be a separate instance of some class (so if you've got 20 daggers, you've got 20 instances of the Dagger class).
If you're displaying them on screen, presumably you have some way to translate from an index to a location on the screen. That means you should have some way to translate from a location on the screen to an index. Alternatively, you presumably have a reference to the instance you're displaying, so deleting it from the List should be pretty easy.
As we've seen here, there isn't one go-to method for using good OO design. Each person is going to have a slightly different take. Do whatever fits in your head the best, and go from there. Chances are, no matter what you write, you're going to come back to it in a year and say "what was I thinking when I did that??" anyway. So I wouldn't recommend you spend a ton of time on the design portion. It's good to know, but it's bad to spend too much time hammering square pegs into round holes. If it fits a certain way in your head, and it works, then that's the design you should use.
That's just my two cents though.
Yeah, I've decided I really shouldn't try and read logic when I first wake up. I've figured out what I want to do and we'll see how it turns out.