I'm designing a basic text-based game and implementing a player/enemy attack structure to start things off. My question is, is it better to design functions in the player class which directly modify values in the enemy class? Or, is it better to design the attack structure so that the enemy HP/MP/etc is modified outside of the player class function and within the game loop?
Apart from that fact, my attackMelee() and attackMagic() funtions don't work in the first place. My compiler throws me an interesting "variable or field attackMelee() declared as void" error, though I'm not returning anything. o.O I've been trying to figure out how class pointers might work in this instance but I'm having no luck there in the first place.
It doesn't matter what design you take on, as long as it doesn't:
1) Hinder the flexibility of your program.
2) Confuse you (to some extent).
3) Prevent you from accomplishing your intended functionality.
Design is something you probably need to learn on your own since I've found that each programmer has his own "style" of design, including myself. You'll probably find no right or wrong answer.
Try something, if it doesn't follow the 3 requirements, move on.
I also cannot help you with your error unless I know the full error.