6.接口.js 306 B

12345678910111213
  1. (function () {
  2. // 使用接口
  3. class Main {
  4. // price: number;
  5. constructor(name, color, price) {
  6. this.name = name;
  7. this.color = color;
  8. // this.price = price;
  9. }
  10. }
  11. let m = new Main('牡丹', '红色', 100);
  12. console.log(m);
  13. })();