Transformation Inheritance

A transformation may extends another transformation using the extends keyword. Only single inheritance is allowed.

The sub transformation inherits all rules of the super transformation, may override these and call the rules of the super using the ‘super’ keyword. The example below illustrates.

import ("TestInheritanceSuper.m2t")
 
texttransformation TestInheritanceSub (in ecmodel:ecore) extends TestInheritanceSuper { 
       ecmodel.EPackage::main() {
         self.printMe()
       }     
      
       ecmodel.EPackage::printMe() {
         stdout.println ("TestIneritanceSub::printMe<")
         super.printMe();
         stdout.println ("TestIneritanceSub::printMe>")
       }
}