Defining class TREENODE as heir of class GRAPHNODE.

Integrating Extension and Specialization Inheritance
by Walid Al-Ahmad and Eric Steegmans
Listing 3. Defining class TREENODE as heir of class GRAPHNODE.


class GRAPHNODE creation Make
     feature
              -- constructors and other features
              link (dir : DIRECTORY) is
                  do
             wtParents(rdNrParents, dir )
             wtNrParents(rdNrParents + 1)
                   end
       moveFile(from : DIRECTORY, to : DIRECTORY) is
                   local
              i : Integer
                  do
              from
               i := 1
              until i <= rdNrParents and rdParents
                                       /= from loop
               i := i + 1
                              end
                              wtParents(i, to)
                   end
        parents : ARRAY [DIRECTORY];
        nrParents : Integer
feature { NONE }
        wtParents (pos : Integer, dir : DIRECTORY) is do
                      parents.put(dir, pos) end
        rdParents (pos : Integer) : DIRECTORY is do Result :=
                     parents @ pos end
        wtNrParents (no : Integer) is nrParents := no end
        rdNrParents : Integer is Result := nrParents end
end
class TREENODE inherit GRAPHNODE
        rename wtParents as wtParent, rdParents as rdParent
        suppress     Parents <wtParent, rdParent>
                 nrParents < no_op, 1>
         end
feature
        parent : DIRECTORY
        ...
feature { NONE }
       wtParent (pos : Integer, dir : DIRECTORY) is  do parent
        rdParent (pos : Integer) : DIRECTORY is do Result := parent end
end