37.4.4 Super and Sub

Two methods provided by the initial object object are super/1 and sub/1. (Note that any definition of super/1, except the one in object, is transformed to super/2). super/1 if sent to an object will return the immediate parents of the object. sub/1 will return the immediate children of the object if any. It is important to note that this service is provided only for objects that have object as their initial ancestor.

     | ?- john :: super(S), S :: sub(john).
     S = sportsman ;
     S = professor ;
     no

The sub/1 property allows programs to traverse object hierarchies from a root object object down to the leaves.