I think that composition makes the most sense here, however I'd recommend dynamic composition over static composition in order to account for anatomical anomalies (missing limbs, etc)
public abstract class Body
{
public Dictionary<string, BodyPart> BodyParts { get; set; }
//other properties, methods, etc.
}
Your BodyPart class might be purely virtual...
public abstract class BodyPart
{
}
You can add specific types of body parts:
public abstract class Limb : BodyPart
{
public float Length { get; set; }
public abstract void Move();
}
If you need to, create subclasses for arms, legs, etc
public class Arm : Limb
{
public override void Move()
{
Debug.WriteLine("Arm is moving");
}
}
Finally, you can subclass your body to be human-specific:
public class HumanBody : Body
{
//properties and methods specific to the human body
}
Putting it all together, you can create a robust HumanBody dynamically:
HumanBody body = new HumanBody();
Arm leftArm = new Arm(){ Length=24F };
Arm rightArm = new Arm(){ Length=24F };
//create other parts
body.BodyParts.Add(new KeyValuePair<string, BodyPart>("LeftArm",leftArm));
body.BodyParts.Add(new KeyValuePair<string, BodyPart>("RightArm",rightArm));
//add other parts
While this is very flexible, the obvious disadvantage is that you'll have to do a fair amount of casting if you actually want to use any of the body parts:
Arm leftArm = body.BodyParts["LeftArm"] as Arm;
leftArm.Move();
Not bad for 2 lines of code, but should you need to coordinate movements the added overhead of casting could be too onerous.
That's my 2c.