[Tutor] Design Question... from a newbie

John Fabiani jfabiani at yolo.com
Thu Oct 21 00:14:30 CEST 2004

On Wednesday 20 October 2004 12:08, nik wrote:
> Another person on the list is asking about good examples for using
> object orientated programming. This could be a good chance to try
> something like that.
> A base class could be person (with basic attributes like 'first name'),
> and then you create derived classes being mage, warrior etc each with
> attributes appropriate to that type of character. Another base class
> could be item, with derived classes weapon, armor, food etc, and then
> derived from that further specifics (ie sword, staff  from the weapon
> class). This makes it easier when it comes to expanding into new classes
> (ie if you wanted to add another character type, ie dwarf, you wouldn't
> have to re-do all the basic attributes that apply to all characters,
> like health points etc, just the stuff that is unique to a dwarf). Each
> level in the class heirachy will introduce it's own relevent attributes.
> Then, when someone decides to be a dwarf, a lot of the attributes will
> be automatically set just because they're using the dwarf class.
> That doesn't answer your question though, but it might help look at
> things a bit differently.
> nik
This sounds like "interfaces".


More information about the Tutor mailing list