Created
January 31, 2018 03:17
-
-
Save alexmasyukov/986cbd2baabee4b8c8e6ab13b60cfd82 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 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); | |
this.color = color; | |
} | |
static getElementType() { | |
return 'is point'; | |
} | |
toString() { | |
return `${super.toString()} is ${this.color}`; | |
} | |
} | |
// const my = new ColorPoint(11, 23, 'red'); | |
// console.log(my.toString()); | |
console.log(ColorPoint.getElementType()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment