coffeescript
Version:
Unfancy JavaScript
26 lines (16 loc) • 358 B
text/coffeescript
class Animal
constructor: () ->
move: (meters) ->
alert + " moved " + meters + "m."
class Snake extends Animal
move: ->
alert "Slithering..."
super 5
class Horse extends Animal
move: ->
alert "Galloping..."
super 45
sam = new Snake "Sammy the Python"
tom = new Horse "Tommy the Palomino"
sam.move()
tom.move()