adding '::' as shorthand for '.prototype.'

This commit is contained in:
Jeremy Ashkenas
2010-01-10 16:16:59 -05:00
parent 902febb43a
commit ad18378f7e
10 changed files with 59 additions and 36 deletions

View File

@@ -141,18 +141,18 @@ aliquam erat volutpat. Ut wisi enim ad."
# Inheritance and calling super.
Animal: =>
Animal.prototype.move: meters =>
Animal::move: meters =>
alert(this.name + " moved " + meters + "m.")
Snake: name => this.name: name
Snake extends Animal
Snake.prototype.move: =>
Snake::move: =>
alert('Slithering...')
super(5)
Horse: name => this.name: name
Horse extends Animal
Horse.prototype.move: =>
Horse::move: =>
alert('Galloping...')
super(45)