Skip to content

Instantly share code, notes, and snippets.

@Storyyeller
Created December 29, 2017 03:01
Show Gist options
  • Save Storyyeller/7f4c1663df3e9c14540708d14bacfa1f to your computer and use it in GitHub Desktop.
Save Storyyeller/7f4c1663df3e9c14540708d14bacfa1f to your computer and use it in GitHub Desktop.
class A {
foo() {return 'foo in A';}
}
class B extends A {
foo() {return 'foo in B';}
}
class C {
foo() {return 'foo in C';}
}
class D extends C {
foo() {return super.foo();}
}
b = new B;
console.log(b.foo()); // foo in B
B.prototype.foo = D.prototype.foo
console.log(b.foo()); // foo in C
console.log(b instanceof C); // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment