Calling a method from the constructor in Coffeescript

Viewed 10466

Is it possible to call a method from the constructor in Coffeescript?
e.g.

class Animal
  constructor: (@name) ->
    move()

  move: (meters) ->
    alert @name + " moved #{meters}m."

class Snake extends Animal
  move: ->
    alert "Slithering..."
    super 5

sam = new Snake "Sammy the Python"

This is generating the following error message "ReferenceError: move is not defined"

2 Answers
Related