Wizards and warriors, part one | Fabulous adventures in coding

<![endif] Fabulous adventures in coding Search Skip to primary content Home About Eric Lippert Photo credits Privacy policy Reprint policy #access #branding ← Previous Next → #nav-single Posted on April 27, 2015 by ericlippert .entry-meta .entry-header A common problem I see in object-oriented design is: A wizard is a kind of player. A warrior is a kind of player. A staff is a kind of weapon. A sword is a kind of weapon. A player has a weapon. But before we get into the details, I just want to point out that I am not really talking about anything specific to the fantasy RPG genre here. Everything in this series applies equally well to Papers and Paychecks , but wizards and warriors are more fun to write about, so there you go. OK, great, we have five bullet points so let’s write some classes without thinking about it! What could possibly go w...

Linked on 2016-11-17 20:12:57 | Similar Links