Ejemplo final de mecanografiado

class Person {
 protected readonly name: string = "jane doe"
 
 protected setName(): string {
   this.name = "john doe"
   return this.name
 }
 
 public resultData(): string {
     return `My name is ${this.setName()}`
  }
}

const res = new Person()
console.log(res.resultData())
Restu Wahyu Saputra