A.4.2 Inheritance of Sections

The IDDL uses an inheritance mechanism similar to inheritance schemes used in object-oriented programming languages. The equivalent to object classes are IDDL-sections. A structure of a section can be passed on to other sections using the inheritance operator (:) followed by the name of the section (the base-section) which may be given by a relative or absolute name, e.g.,

Section10
{  x1 = -3;
   x2 = 17;
}
Section11 : Section10;

First a section named Section10 is defined. Subsequently the section Section11 is inherited from section Section10 and, thus, contains all elements (variables and all subsections) of section Section10.

The semicolon after the inheritance statement is necessary to express that no changes are performed within Section11.

It is important to note, that sections passed to other sections using inheritance are not copied or duplicated. Therefore, if items in the base-section are changed the changes will affect all derived sections.

Another more complex example:

Section12
{  x1 = -3;
   x2 = 17;
   Section12A
   {  y1 = 2;
      y2 = 5;
   }
   Section12B : Section12A;
}
Section13 : Section12;

The base-section Section12 contains two variables (x1 and x2) and two sections (Section12A and Section12B). Section Section12A contains two variables (y1 and y2) which are passed on to section Section12B. The last section Section13 is inherited from section Section12 and therefore contains four elements (the variables x1 and x2 and the sections Section12A and Section12B).

The subsection ~Section13.Section12B, for instance, has been inherited from the section ~Section12.Section12A and, therefore, contains the variables y1 and y2.

Robert Klima 2003-02-06