class Person {
    constructor() {
    }

    private _name:string;

    public get name():string{
        return this._name;
    }

    public set name(name:string){//不能定义返回类型,如: ":void"
        this._name = name;
    }
}

相关文章:

  • 2021-07-10
  • 2022-02-20
  • 2021-06-11
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-25
  • 2022-02-23
  • 2021-05-31
  • 2022-12-23
相关资源
相似解决方案