Skip to content

Instantly share code, notes, and snippets.

@pedrogk
Created July 3, 2016 00:05
Show Gist options
  • Save pedrogk/8f437c4c095c4263ae5255f19fd7dd37 to your computer and use it in GitHub Desktop.
Save pedrogk/8f437c4c095c4263ae5255f19fd7dd37 to your computer and use it in GitHub Desktop.
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
toString() {
return '(' + this.x + ', ' + this.y + ')';
}
}
class ColorPoint extends Point {
constructor(x, y, color) {
super(x, y); // (A)
this.color = color;
}
toString() {
return super.toString() + ' in ' + this.color; // (B)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment