Skip to content

Instantly share code, notes, and snippets.

@ryanbrubaker
Created July 10, 2012 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanbrubaker/3085435 to your computer and use it in GitHub Desktop.
Save ryanbrubaker/3085435 to your computer and use it in GitHub Desktop.
CoffeeScript class example taken from coffeescript.org
class Animal
constructor: (@name) ->
move: (meters) ->
alert @name + " moved #{meters}m."
class Snake extends Animal
move: ->
alert "Slithering..."
super 5
sam = new Snake "Sammy the Python"
sam.move()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment