The Science of Programming/SwayPresentations/Objects/ExtensionInheritance

Extension Inheritance

Extension inheritance: whereby the subclass adds features not found in the superclass.

   function super(a)
       {
       var b = a + 1 * (a - 1);
       this;
       }
   
   function sub()
       {
       var c = 3;
       extends(super(c * c));
       }

Now we make a sub object:

   var s = sub();
   inspect(s . b);

The output is:

   s . b is 80

Next Previous Top