Created
August 22, 2015 07:07
-
-
Save H2CO3/f6368b504cbb3c11fe46 to your computer and use it in GitHub Desktop.
prototypal inheritance demo in Sparkling
This file contains hidden or 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
let base = { | |
foo: fn (self) { | |
stdout.printf("base::foo(self.type = %s)\n", self.type); | |
}, | |
type: "base" | |
}; | |
let derived = { | |
super: base, | |
bar: fn { print("derived::bar"); }, | |
type: "derived" | |
}; | |
base.foo(); | |
derived.foo(); | |
derived.bar(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment