Skip to content

Instantly share code, notes, and snippets.

@the-teacher
Created August 13, 2013 14:01
Show Gist options
  • Save the-teacher/6221417 to your computer and use it in GitHub Desktop.
Save the-teacher/6221417 to your computer and use it in GitHub Desktop.
@log = -> console.log.apply(console, arguments)
class @Animal
constructor: (name = 'Abstract animal') ->
@name = name
Animal::eat = (food) ->
log(food)
class @Dog extends Animal
constructor: ->
super('Dog')
blah: ->
log "Blah Blah"
$ ->
dog = new Dog
log dog.name # => Dog
log dog instanceof Animal # => true
log dog instanceof Dog # => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment