protected

· FE/Typescipt
접근 제어자(Acess Modifier) public : default, 어디서나 자유롭게 접근 가능 protected : 나와 파생된 후손 클래스 내에서 접근 가능 private : 클래스 내에서만 접근 가능 class userA { constructor(public first : string, protected last : string,private age : number) { this.first = first this.last = last this.age = age } } class UserB extends UserA() { getAge() { return `${this.first} ${this.last} is ${this.age}` //first, last 사용 가능 but age는 접근 불간ㅇ ..
따봉치치
'protected' 태그의 글 목록