Skip to content

Instantly share code, notes, and snippets.

@Storyyeller
Last active December 29, 2017 05:59
Show Gist options
  • Save Storyyeller/658d49f95813620bad6dd0c4177d2d9b to your computer and use it in GitHub Desktop.
Save Storyyeller/658d49f95813620bad6dd0c4177d2d9b to your computer and use it in GitHub Desktop.
class A {
foo() {return 'foo in A';}
}
class B {
foo() {return 'foo in B';}
}
class C extends A {
foo() {
console.log(super.foo()); // foo in A
Object.setPrototypeOf(C.prototype, B.prototype);
console.log(super.foo()); // foo in B
}
}
c = new C;
c.foo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment