Skip to content

Instantly share code, notes, and snippets.

@thelinuxlich
Created March 15, 2011 17:29
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 thelinuxlich/871090 to your computer and use it in GitHub Desktop.
Save thelinuxlich/871090 to your computer and use it in GitHub Desktop.
class @Animal
constructor: () ->
@id = ""
@urls: []
@print: ->
console.log @urls
printInternal: ->
console.log(@urls)
class @Dog extends @Animal
@urls: ["aaa"]
class @Cat extends @Animal
@urls: ["bbb"]
class @Rat extends @Animal
# this prints ["aaa"]
@Dog.print()
# this prints ["bbb"]
@Cat.print()
# this prints an empty array
@Rat.print()
d = new @Dog()
# this doesn't print ["aaa"] :(
d.printInternal()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment