Torus is child of Cube and Cube is the child of the Sphere
The Parenting script connects objects together through a parent/child
relationship. It does this by connecting the OwnerMatrix of the
child to the WldMatrix of the parent and putting the difference in the
child Matrix connector. To parent select 2 or more objects.
The last object selected will be the parent. Click on the "Parent"
button and all the objects will be parented. To un-parent select
one or more child objects and click the "Unparent" button.
Download the Parenting script here

click picture
The script will cause a crash if parenting is circular. If you
parent A to B to C and then back to A, you get a circular parenting.
The top picture would be circular if you made the Torus the parent of
the Sphere.
The parenting can give strange results if the parent object is scaled.
The parent scale should be set to 1,1,1 before parenting.
Otherwise the parents scale will be applied to the children and they
will become distorted. You can use the freeze transform script on
the meshes to fix this problem. The freeze transform script only
works on mesh objects. It won't work on an unedited primitive.
Select the object to freeze and push the Start button.
Download the freezeTransform751 script here

click the picture
The freeze transform will set the scale to 1,1,1 and set rotations to
0,0,0 without affecting the appearance of the mesh. It only works
on single mesh objects not groups(encapsulated objects).
The parenting animation won't show in modelspace. A procedural
clip will have to be added to the children and keyframes generated for
it before the animation will show properly in modelspace.
Animation works without any extra steps for real time animations.