Created
July 3, 2016 00:05
-
-
Save pedrogk/8f437c4c095c4263ae5255f19fd7dd37 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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