2010-01-26 10:52:05 -05:00
|
|
|
Base: ->
|
|
|
|
Base::func: (string) ->
|
2009-12-28 23:08:02 -05:00
|
|
|
'zero/' + string
|
2009-12-24 19:23:23 -05:00
|
|
|
|
2010-01-26 10:52:05 -05:00
|
|
|
FirstChild: ->
|
2009-12-25 16:57:47 -05:00
|
|
|
FirstChild extends Base
|
2010-01-26 10:52:05 -05:00
|
|
|
FirstChild::func: (string) ->
|
2009-12-28 23:08:02 -05:00
|
|
|
super('one/') + string
|
2010-01-06 23:34:56 -05:00
|
|
|
|
2010-01-26 10:52:05 -05:00
|
|
|
SecondChild: ->
|
2009-12-25 16:57:47 -05:00
|
|
|
SecondChild extends FirstChild
|
2010-01-26 10:52:05 -05:00
|
|
|
SecondChild::func: (string) ->
|
2009-12-28 23:08:02 -05:00
|
|
|
super('two/') + string
|
2010-01-06 23:34:56 -05:00
|
|
|
|
2010-01-26 10:52:05 -05:00
|
|
|
ThirdChild: ->
|
2010-02-03 18:16:31 -05:00
|
|
|
@array: [1, 2, 3]
|
2010-02-09 07:59:48 -05:00
|
|
|
this
|
2009-12-25 16:57:47 -05:00
|
|
|
ThirdChild extends SecondChild
|
2010-01-26 10:52:05 -05:00
|
|
|
ThirdChild::func: (string) ->
|
2009-12-28 23:08:02 -05:00
|
|
|
super('three/') + string
|
2009-12-24 19:23:23 -05:00
|
|
|
|
2010-01-24 23:40:45 -05:00
|
|
|
result: (new ThirdChild()).func 'four'
|
2009-12-24 19:23:23 -05:00
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok result is 'zero/one/two/three/four', 'successfully set up and called a four-level inheritance chain'
|
2009-12-24 19:23:23 -05:00
|
|
|
|
2010-01-08 10:54:44 -05:00
|
|
|
|
2010-01-26 10:52:05 -05:00
|
|
|
TopClass: (arg) ->
|
2010-02-03 18:16:31 -05:00
|
|
|
@prop: 'top-' + arg
|
2010-02-09 07:59:48 -05:00
|
|
|
this
|
2010-01-08 10:54:44 -05:00
|
|
|
|
2010-01-26 10:52:05 -05:00
|
|
|
SuperClass: (arg) ->
|
2010-01-24 23:40:45 -05:00
|
|
|
super 'super-' + arg
|
2010-02-09 07:59:48 -05:00
|
|
|
this
|
2010-01-08 10:54:44 -05:00
|
|
|
|
2010-01-26 10:52:05 -05:00
|
|
|
SubClass: ->
|
2010-01-24 23:40:45 -05:00
|
|
|
super 'sub'
|
2010-02-09 07:59:48 -05:00
|
|
|
this
|
2010-01-08 10:54:44 -05:00
|
|
|
|
|
|
|
SuperClass extends TopClass
|
|
|
|
SubClass extends SuperClass
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok (new SubClass()).prop is 'top-super-sub', 'inheritance'
|