Created
July 10, 2012 18:41
-
-
Save ryanbrubaker/3085435 to your computer and use it in GitHub Desktop.
CoffeeScript class example taken from coffeescript.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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