Skip to content · ⁨본문 바로가기⁩
English

Build on an existing class

  • Inheritance lets a new class reuse an existing one.
  • The new class is the subclass (child); the original is the superclass (parent).
  • Write class Bird(Animal): — Bird gets all of Animal's methods. (In exam pseudocode: CLASS Bird INHERITS Animal.)

한국어

기존 클래스 확장하기

  • **상속(inheritance)**은 새로운 class가 기존 class를复用할 수 있게 합니다.
  • 새로운 class는 **하위クラス(subclass, child)**이고, 원본은 **상위 superclass, parent)**입니다.
  • class Bird(Animal):를 작성합니다 — Bird는 Animal의 모든 메소드를继承합니다. (시험용 가짜코드: CLASS Bird INHERITS Animal.)

An Animal parent with describe(); Bird and Cow inherit it, adding or overriding methods

Handout · ⁨교재 자료⁩

Log in or create account · ⁨로그인 또는 계정 만들기⁩

IGCSE, A-Level & AP