Skip to content

Instantly share code, notes, and snippets.

@H2CO3
Created August 22, 2015 07:07
Show Gist options
  • Save H2CO3/f6368b504cbb3c11fe46 to your computer and use it in GitHub Desktop.
Save H2CO3/f6368b504cbb3c11fe46 to your computer and use it in GitHub Desktop.
prototypal inheritance demo in Sparkling
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