运行 ❯
获取您
自己的 Node
服务器
×
更改方向
更改主题,暗色/亮色
转到 Spaces
class Person { private name: string; public constructor(name: string) { this.name = name; } public getName(): string { return this.name; } } const person = new Person("Jane"); console.log(person.getName()); // person.name isn't accessible from outside the class since it's private
Jane