• 모닥위키모닥위키
  • 모닥위키
위키
  • 임의문서
  • 주간인기
  • 문서
  • 시리즈
    AAAdddvvveeerrrtttiiissseeemmmeeennntttAdvertisement

    © 2025 modak.wiki All rights reserved.

      프로토타입 상속과 프로토타입 체인

      Chapter 17 - Prototype Inheritance and Prototype Chain

      컴퓨터/IT학습
      lu

      luasenvy (luasenvy)

      CC BY 4.0 국제규약

      프로토타입 체인

      클래스와 팩토리 디자인 패턴 참고

      프로토타입 상속

      class Life {
        constructor(live) {
          this.live = live;
        }
      }
      
      class Human extends Life {
        constructor(live, name) {
          super(live);
      
          this.name = name;
        }
      }
      

      프로토타입 체인으로 지정된 대상 객체의 모든 멤버를 상속받을 수 있다. __proto__ 등을 직접 사용하여 연결하는 방식 등 매우 지저분하였으나 ES6 이후로 class 문법이 공식 지원되면서 다른 언어들처럼 extends와 super 키워드 등을 통하여 깔끔하게 작성할 수 있게 되었다.

      초판: 2024. 08. 19. 10:41:43

      © 2024 이 문서는 "CC BY 4.0 국제규약" 라이선스로 배포 되었습니다. 모든 권리는 저자에게 있습니다.

      프로토타입 상속과 프로토타입 체인

      프로토타입 체인
      프로토타입 상속