Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var Foo = Class.create({
  initialize: function(){
    console.log('initializing new Foo');
  },
  someMethod: function(){
    console.log('someMethod on Foo');
  }
});

var Bar = Class.create( Foo, {
  initialize: function($super){
    console.log('initializing new Bar');
    $super();
  },
  someMethod: function($super){
    console.log('someMethod on Bar');
    $super();
  }
});

Bar.addMethods({
  someMethod: function($super){
    console.log("overridden someMethod on Bar");
    $super();
  }
});

var f = new Foo();
f.someMethod();

var b = new Bar();
b.someMethod();