Код IT Загрузка примера кода…

TypeScript main.ts
class Entity {
  constructor(public id: string) {}
}

class Product extends Entity {
  constructor(
    id: string,
    public title: string,
    public price: number,
  ) {
    super(id);
  }

  label(): string {
    return `${this.title} (${this.price})`;
  }
}
class Entity {
  constructor(public id: string) {}
}

class Product extends Entity {
  constructor(
    id: string,
    public title: string,
    public price: number,
  ) {
    super(id);
  }

  label(): string {
    return `${this.title} (${this.price})`;
  }
}