The Science of Programming/SwayPresentations/Objects/VariationInheritance

 Variation Inheritance 

Variation inheritance: whereby the subclass changes a behavior of the super class.

function super {       var greeting = "hello"; function a { greeting; } this; }   function sub {       function a { "well, " + a. prior + " there!"; } extends(super); }   var s = sub; println(s . a);

The output is:

well, hello there!

Looking at the s object gives:

: context:  dynamicContext:  callDepth: 1 constructor:  this:  a:  a:  greeting: "hello"

Next Previous Top