object $human
parents $creature;
endobject
object $orc
parents $creature;
endobject
object $half_orc
parents $human, $orc;
endobject
object $human
parents $creature;
endobject
object $orc
parents $creature;
endobject
object $half_orc
parents $human, $orc;
endobject
object $half_half_orc
parents $human, $half_orc
endobject
object $quarter_orc
parents $human, $half_orc
endobject
// wizard is previously defined
Dragon dragon = new Dragon ();
wizard.shapeShift ( dragon );
// inside the shapeShift() method:
Creature oldBody = this.body;
this.body = dragon;
this.body.soul = this;
this.body.setStats ( oldBody.getStats () );
this.body.setSkills ( oldBody.getSkills () );
pWizard->GetRace()->Set(IRace::eRaceDragon)Or for a half-orc:
pWizard->GetRace()->Set(IRace::eRaceHuman, IRace::eRaceOrc)Or whatever else you fancy.
I'm kind of leaning toward a non-traditional(?) inheritance model, where a "race" (ex. Human) would just be a subclass of Creature, rather than a subclass of a Race class which Creature would instantiate. In my model, I would just leave the Race class out entirely. For those who -do- have a Race class, what kind of behavior does it implement that you don't think would logically fit into the Creature/Human classes?