더북(TheBook)
  changeAge(age: number) {
    this.age = age;
  }
}
// Cannot assign to 'age' because it is a read-only property.
class Child extends Parent {
  constructor(name: string, age: number, married: boolean) {
    super(name, age, married);
  }
  sayName() {
    console.log(this.name);
  }
  sayMarried() {
    console.log(this.married);
  }
  sayValue() {
    console.log(this.value);
  }
}
// Property 'value' is private and only accessible within class 'Parent'.
const child = new Child('zero', 28, false);
child.name;
child.married;
// Property 'married' is protected and only accessible within class 'Parent' and its subclasses.
child.value;
// Property 'value' is private and only accessible within class 'Parent'.
신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.