14 lines
377 B
TypeScript
14 lines
377 B
TypeScript
class Point {
|
|
constructor(public x: number, public y: number) { }
|
|
public toString() {
|
|
return "x=" + this.x + " y=" + this.y;
|
|
}
|
|
}
|
|
class ColoredPoint extends Point {
|
|
constructor(x: number, y: number, public color: string) {
|
|
super(x, y);
|
|
}
|
|
public toString() {
|
|
return super.toString() + " color=" + this.color;
|
|
}
|
|
}
|