Last active
December 29, 2017 05:59
-
-
Save Storyyeller/658d49f95813620bad6dd0c4177d2d9b to your computer and use it in GitHub Desktop.
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
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