mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
50 lines
No EOL
935 B
CoffeeScript
50 lines
No EOL
935 B
CoffeeScript
class Base
|
|
func: (string) ->
|
|
"zero/$string"
|
|
|
|
@static: (string) ->
|
|
"static/$string"
|
|
|
|
class FirstChild extends Base
|
|
func: (string) ->
|
|
super('one/') + string
|
|
|
|
class SecondChild extends FirstChild
|
|
func: (string) ->
|
|
super('two/') + string
|
|
|
|
class ThirdChild extends SecondChild
|
|
constructor: ->
|
|
@array: [1, 2, 3]
|
|
|
|
# Gratuitous comment for testing.
|
|
func: (string) ->
|
|
super('three/') + string
|
|
|
|
result: (new ThirdChild()).func 'four'
|
|
|
|
ok result is 'zero/one/two/three/four'
|
|
ok Base.static('word') is 'static/word'
|
|
|
|
|
|
class TopClass
|
|
constructor: (arg) ->
|
|
@prop: 'top-' + arg
|
|
|
|
class SuperClass extends TopClass
|
|
constructor: (arg) ->
|
|
super 'super-' + arg
|
|
|
|
class SubClass extends SuperClass
|
|
constructor: ->
|
|
super 'sub'
|
|
|
|
ok (new SubClass()).prop is 'top-super-sub'
|
|
|
|
|
|
class OneClass
|
|
constructor: (name) -> @name: name
|
|
|
|
class TwoClass extends OneClass
|
|
|
|
ok (new TwoClass('three')).name is 'three' |