Created
January 12, 2011 12:40
-
-
Save bartschuller/776109 to your computer and use it in GitHub Desktop.
Figuring out prototypes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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