[NAME]
ALL.dao.class.mixin

[TITLE]
Mixin Class

[DESCRIPTION]

Definition of new classes may also include other classes that will be used as components
and merged (mixed) into the new classes. The component (mixin base) classes can be specif
ied in a pair of brackets following the class name. Only classes without parent classes c
an be used as mixin bases.
     
   1  class Base
   2  {
   3      var value = 456
   4      routine Meth2(){ io.writeln( self, value ) }
   5  }
   6  
   7  class Mixin ( Base )
   8  {
   9      var index = 123
  10  
  11      routine Meth(){ io.writeln( self, index, value ) }
  12      routine Meth2( a : string ){ io.writeln( self, index, value, a ) }
  13  }
  14  
  15  #
  16  # The "Base" class will be presented only once in "Klass":
  17  #
  18  class Klass ( Base, Mixin )
  19  {
  20      var index = 123456
  21      routine Meth2( a : int ){ io.writeln( self, index, value, a ) }
  22  }
  23  
  24  k = Klass()
  25  
  26  io.writeln( k.index )
  27  
  28  k.Meth()
  29  k.Meth2()
  30  k.Meth2( 'abc' )
  31  k.Meth2( 789 )