
protected, static 키워드
protected 키워드 class User{ protected x=10; } protected 키워드를 통해 필드 생성 class NewUser extends User{ doThis(){ this.x = 20; } } => extends로 상속받은 자식까지 필드값을 사용할 수 있게 제한. this 연산자를 통해 부모의 필드값에 접근할 수 있음. static 키워드 class User { x = 10; y = 20; } let john = new User(); john.x //가능 User.x //불가능 static 사용 전 => 인스턴스 객체로 필드값을 접근할 수 있으나, 클래스. 필드 방법으로는 접근할 수 없음. class User { static x = 10; y = 20; } let john = ..