This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a list of items that I keep track of in a method in my character class. In another class, I want to be able to print out and keep track of whichever of those items i still have in that method in the character class. In other words, if i have an apple, banana, and orange, I want to have a code that can scan my list of items, see which ones i have and register those in this new class. here is my code. There is a good chance this simply involves making a list, but I don't think I have learned to do that and for some reason the internet is so hard to find the answer to simple questions.
I'm not sure I understand. From what I gather, you want to insert something at line 35 that will display a list of available items in the Character class. Right?
Your items() method is currently just assigning values to variables. Is that your current "list"? If so, what do the values of '1' represent? Are these quantities (e.g., how many mpotions are available)? What exactly would you want returned from that example?
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
ive done some more reading and figured out how to make an array and solve this problem. I am not going to even bother posting my further questions about arrays because I know that I will figure this stuff out on my own as I keep reading. Thanks for the help guys.
Joined: Oct 13, 2005
Why have you got so many fields in that class? Why have you given them public access?
Joined: Dec 15, 2011
ritchie if i dont make them public, my other classes dont recognize them