mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
21 lines
434 B
C#
21 lines
434 B
C#
Animal: => .
|
|
Animal.prototype.move: meters =>
|
|
alert(this.name + " moved " + meters + "m.").
|
|
|
|
Snake: name => this.name: name.
|
|
Snake extends new Animal()
|
|
Snake.prototype.move: =>
|
|
alert("Slithering...")
|
|
super(5).
|
|
|
|
Horse: name => this.name: name.
|
|
Horse extends new Animal()
|
|
Horse.prototype.move: =>
|
|
alert("Galloping...")
|
|
super(45).
|
|
|
|
sam: new Snake("Sammy the Python")
|
|
tom: new Horse("Tommy the Palomino")
|
|
|
|
sam.move()
|
|
tom.move()
|