Practice Flashcards
Flip to reveal answersWhat is polymorphism?
Track your progress — Sign up free to save your progress and get smart review reminders based on spaced repetition.
All 5 Flashcards — Polymorphism
Sign up free to track progress and get spaced-repetition review schedules.
Question
What is polymorphism?
Answer
The **same call** behaving differently depending on the object it is made on — the caller never asks what type it holds.
Question
Overriding or overloading: same name, different parameters, one class?
Answer
**Overloading** — resolved at compile time. Overriding is a child replacing a parent's method, resolved at run time.
Question
What does polymorphism replace?
Answer
A type-checking **if-chain**, repeated everywhere the objects are handled — and every copy is a place to forget a type.
Question
What does adding a new subclass cost in polymorphic code?
Answer
**Nothing** — it works with existing loops immediately, so no working code is edited and nothing can break.
Question
Is inheritance the same as polymorphism?
Answer
No. Inheritance **shares** a method; polymorphism is the same call **resolving differently** per object. Inheritance is usually how it is achieved.
Read the notes
Full study notes for Polymorphism
Topic 7.2 hub
OOP: multiple classes
More from Topic 7.2
All flashcards in this topic
Computer Science exam skills
Paper structures & tips
Track your progress with spaced repetition
Sign up free — Aimnova tells you exactly which cards to review and when, so you remember everything before your IB exam.
Start Free