The Science of Programming/SwayPresentations/Objects/Examples6

From Wikibooks, open books for an open world
< The Science of Programming‎ | SwayPresentations/Objects
Jump to: navigation, search

So you really want multiple inheritance?

   function super()
       {
       var x = 3;
       var z = x * x;
       this;
       }
   function duper()
       {
       var y = 4;
       var z = y * y;
       this;
       }
   function sub()
       {
       extends(super());
       extends(duper());
       }
   inspect(sub() . x);
   inspect(sub() . y);
   inspect(sub() . z);

What would you expect the value of z to be?


Next Previous Top