    [NAME]
    ALL.dao.class.inheritance

    [TITLE]
    Inheritance

    [DESCRIPTION]

    In Dao, new classes can be derived from existing classes (and/or C data types) to
    inherit their functionalities and to establish is-a relationship between objects. When a
    class A is derived from another class B, class A is usually referred to as a child, or
    derived, or sub- class, and the class B is ussually referred to as a parent or base
    class.

    To derive one class from another, the base class must be placed after the class name of
    the derived one separated by a colon. <red>(Since 2013-10-20, classic multiple
    inheritance is no longer support. Now mixins are the preferred way to do similar
    things.)</red>

    Here is a simple example,

       1  class Base
       2  {
       3      var id = 0
       4
       5      routine Base( i = 0 ){ id = i }
       6  }
       7  class Sub : Base
       8  {
       9      var value = 'abc'
      10  }
      11  obj = Sub()

    In this example, an instance of the derived class is created by calling its implicit
    default constructor, which will call an constructor (either implicit or explicit) of the
    derived class that accepts no parameters.

    When defining a constructor of a derived class, the constructor of a base class can be
    called explicitly, by placing the call right after the constructor signature of the
    derived on separated by a colon. The call to a base constructor can only accept the
    parameters (or the self variable) of the constructor of the derived class.

       1  class Sub : Base
       2  {
       3      var value = 'abc'
       4
       5      routine Sub( v = 'ABC', i = 3 ) : Base( i ) { value = v }
       6  }

       1  load meta
       2
       3  class Base
       4  {
       5      var id = 0
       6
       7      routine VirtMeth(){ io.writeln( 'Base::VirtMeth()' ) }
       8      routine NormMeth(){
       9          meta.self( self ).VirtMeth() # emulate virtual method call;
      10      }
      11  }
      12  class Sub : Base
      13  {
      14      var value = 'abc'
      15      routine VirtMeth(){ io.writeln( 'Sub::VirtMeth()' ) }
      16  }
      17  o : Base = Sub()
      18  o.NormMeth() # prints: Sub::VirtMeth()