mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
34 lines
499 B
JavaScript
34 lines
499 B
JavaScript
class Point {
|
|
constructor(x, y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
get dist() {
|
|
return Math.sqrt(this.x*this.x+this.y*this.y);
|
|
}
|
|
|
|
toString() {
|
|
return "(" + this.x + ", " + this.y + ")";
|
|
}
|
|
|
|
static className() {
|
|
return "Point";
|
|
}
|
|
}
|
|
|
|
class ColouredPoint extends Point {
|
|
constructor(x, y, colour) {
|
|
super(x, y);
|
|
this.colour = c;
|
|
}
|
|
|
|
toString() {
|
|
return super.toString() + " in " + this.colour;
|
|
}
|
|
|
|
static className() {
|
|
return "ColouredPoint";
|
|
}
|
|
}
|