Super
- super 키워드는 자식 클래스 내에서 부모 클래스의 생성자를 호출할 때 사용됨.
- super 키워드는 자식 클래스 내에서 부모 클래스의 메소드를 호출할 때 사용됨.
![](https://velog.velcdn.com/images/kimquaresma/post/365a97a2-dcec-4716-a731-70967b6aa3b3/image.png)
- Super 이후에 this 키워드
- 생성자 에서는 super키워드 하나만 사용되거나 this 키워드가 사용되기 전에 호출되어야 함.![](https://velog.velcdn.com/images/kimquaresma/post/07c3ad52-e21a-4a39-a18e-e817742190c4/image.png)
- super 이후에 this 키워드가 나와야 하는 이유
- 아래 소스 코드에서 처럼 부모 클래스의 생성자를 호출 하기 전에 this.name을 사용하려고 하면 문제가 되기 때문
- react에서 this.state을 생성자에서 정의할 때 super가 먼저와야 하는 이유도 이와 같음
뛰어난 글이네요, 감사합니다.