Skip to content · ⁨דלג לתוכן⁩

Inheritance & encapsulation · ⁨יורשת ואינקספולציה⁩

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

עברית

בנה על מחלקה קיימת

  • ירישה מאפשרת לקלאס חדש להשתמש בקלאס קיים.
  • הקלאס החדש הוא קלאס בן (ילד); הקלאס המקורי הוא קלאס אב (הורה).
  • כתוב class Bird(Animal): — Bird יקבל את כל הפונקציות של Animal. (בסימולית לבחינות: CLASS Bird INHERITS Animal.)

הורה בעלי חיים עם describe(); ציפור ובקר יורשים אותו, מוסיפים או משנים פונקציות

Handout · ⁨חומר עזר⁩

Log in or create account · ⁨היכנס או צור חשבון⁩

IGCSE, A-Level & AP