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.
So I'm making a craps game. I have a class "Player" and a class "Bet". The constructor of player sets the name, bankroll, and creates a new Bet(). My question is, how do I access those Bet methods associated with that player. Specifically, I have a method called "setBet()" that I'm trying to call. For the life of me, I can't remember how to do it. (I tried stupid things like player.bet.setBet() ).
Thanks for any help, I'm sure this one will be easy for you guys to answer.
The answer depends on your code. If the Bet is in a non-private member of Player named "bet", then player.bet.setBet() could be exactly right. But there are many other possibilities, so you're going to have to show us what you've got. Please use "CODE" tags to format your code (see the "Instant UBB Code" area on the message editing screen.)