Skip to content

Inheritance & encapsulation

Handout

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

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

Handout

Log in or create account

IGCSE & A-Level