Not to but in or anything, but I just wanted to point something out:
Quote:
[EDIT]: Another example, let's suppose you decided you wanted to alert the player when the health went under a certain value. With a set method (although other methods such as subtractHealth or what-not might be better, let's keep it simple) you could check to see if the health was below the value you wanted to alert at and then alert the player, with no changes to your calling code.
This is called an event, and doesn't belong in the class in the first place, since it's dependant completely on its environment. For example, using your subtractHealth method to alert the player may be useful in the game, but it creates more dependencies when you want to reuse the 'Player' class in other programs, e.g. a level editor, or another game that doesn't need to alert the player.
Anyway, just wanted to point that out.