Skip to content

Instantly share code, notes, and snippets.

@DveMac
Created April 3, 2011 17:18
Show Gist options
  • Save DveMac/900580 to your computer and use it in GitHub Desktop.
Save DveMac/900580 to your computer and use it in GitHub Desktop.
base class
class Animal
_eating = false
constructor: ->
# some stuff
dolunch: ->
if not _eating
eatWithCallback 'sandwich', ()->
sys.puts 'yum'
_eating = false
eatWithCallback: (food, cb)->
# override me
class Lion extends Animal
eat: (food, cb)->
cb()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment