Yeah, posting code and context is a good idea when asking for help.
My guess based on name is that what you should have is something like:
in the Player class have a method increasePower(int amount)
and in the other class, if you are given p as the current Player, do p.increasePower(1).
I'm guessing power is a private variable and hence you get issues.
__________________
Note: The viewpoint posted above does not necessarily reflect the opinion of Zuneboards, Crowdgather, Nurta, Cyber Connect Corporation, Nurta.net, fairpolls.org, or any affiliate thereof. Also, this posting is provided "as-is" with no warranties, and confers no rights. In fact, this posting has no guarantee whatsoever and may be true, false, or both. This posting may be hurtful, helpful, or both. If you feel this posting was too hurtful, please contact me so I can set aside some pity time for you, which is offered "as-is" with no warranties, confers no rights, and may or may not occur, at my discretion. If you respond to this posting in any form, including but not limited to: a laugh, chortle, grimace, or sigh, you agree to these terms and agree to drive heavy machinery while taking child's cold medicine.
This disclaimer is provided "as-is" with no warranties, and confers no rights.
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


|