Skip to content

Instantly share code, notes, and snippets.

@bartschuller
Created January 12, 2011 12:40
Show Gist options
  • Save bartschuller/776109 to your computer and use it in GitHub Desktop.
Save bartschuller/776109 to your computer and use it in GitHub Desktop.
Figuring out prototypes
sys = require('sys')
print = sys.print
class A
bar: ->
print "A's bar\n"
this.baz()
baz: ->
print "A's baz\n"
class B extends A
baz: ->
print "B's baz\n"
a = new A
a.bar()
b = new B
b.bar()
# Prints:
#
# A's bar
# A's baz
# A's bar
# B's baz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment