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.)

ไทย

Build on an existing class

  • Inheritance ทำให้ new class สามารถ reuse一个 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.)

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

Handout · ⁨เอกสารประกอบการเรียน⁩

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP