运行 ❯
获取你自己的 Node
×
更改方向
更改主题,深色/浅色
转到空间
interface Shape { getArea: () => number; } class Rectangle implements Shape { public constructor(protected readonly width: number, protected readonly height: number) {} public getArea(): number { return this.width * this.height; } } const myRect = new Rectangle(10,20); console.log(myRect.getArea());
200