Skip to content

Instantly share code, notes, and snippets.

@alexmasyukov
Created January 31, 2018 03:17
Show Gist options
  • Save alexmasyukov/986cbd2baabee4b8c8e6ab13b60cfd82 to your computer and use it in GitHub Desktop.
Save alexmasyukov/986cbd2baabee4b8c8e6ab13b60cfd82 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);
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