aımnova
DashboardMy LearningCrash CoursesStudy Plan

Aimnova site navigation

Stay in the loop

Get the latest study resources and updates

New features, study tips and exam insights — straight to your inbox.

IB Diploma

  • IB Past Papers
  • IB Study Notes
  • IB Question Bank
  • IB Mock Exams
  • IB Revision

IB Subjects

  • IB Math AA
  • IB Math AI
  • IB Economics
  • IB Business Management
  • IB Physics
  • IB Biology
  • View all IB subjects→

IB Past Papers

  • IB Math AA HL Past Papers
  • IB Math AA SL Past Papers
  • IB Math AI HL Past Papers
  • IB Math AI SL Past Papers
  • IB Economics HL Past Papers
  • IB Economics SL Past Papers
  • IB ESS Past Papers
  • View all past papers→

Study Resources

  • Study Notes
  • Question Bank
  • Mock Exams
  • Crash Courses
  • Flashcards
  • Revision Guide
  • Exam Skills
  • Command Terms
  • Grade Calculator
  • Exam Timetable 2026

Aimnova

  • Features
  • Pricing
  • For Teachers
  • For Schools
  • For Parents
  • About Us
  • Blog
  • Contact
aımnova

IB study, practice and feedback built around the real exam.

TermsPrivacyCookies·© 2026 Aimnova. All rights reserved.c1e448f

Aimnova is not affiliated with or endorsed by the International Baccalaureate Organization (IB).

NotesComputer Science HLTopic 7.2Polymorphism
Back to Computer Science HL Topics
7.2.24 min read

Polymorphism (Computer Science HL)

IB Computer Science · Unit 7

Your first topic is free to keep

Know exactly what to write for full marks

Practice with exam questions and get AI feedback that shows you the perfect answer — what examiners want to see.

Start Free

Contents

  1. 1One call, many behaviours
  2. 2The two forms
  3. 3Why it matters
  4. 4Exam-style question
The big idea: Polymorphism means the same call does the right thing for whatever object it is made on.
Shapes: Calling area() on a list of shapes gives each shape's own calculation. The calling code never asks what kind of shape it holds.
class Shape:
    def area(self):
        raise NotImplementedError

class Circle(Shape):
    def area(self):
        return 3.14159 * self.r ** 2

class Rectangle(Shape):
    def area(self):
        return self.w * self.h

for s in [Circle(2), Rectangle(3, 4)]:
    print(s.area())        # each object runs ITS OWN version
abstract class Shape {
    abstract double area();
}

class Circle extends Shape {
    double r;
    @Override double area() {
        return 3.14159 * this.r * this.r;
    }
}

class Rectangle extends Shape {
    double w, h;
    @Override double area() {
        return this.w * this.h;
    }
}

for (Shape s : new Shape[]{ new Circle(2), new Rectangle(3, 4) }) {
    System.out.println(s.area());   // each object runs ITS OWN version
}
The loop never asks what it is holding: No if isinstance and no type check anywhere. The object itself decides which method runs, which is the whole point — and why a new shape needs no change to this loop.

Free preview

This is the free notes preview

You're reading the free notes. Aimnova Pro unlocks the full study experience — and you can try it with your first topic free to keep:

  • FlashcardsLock in vocabulary and key terms with spaced repetition.
  • Practice questionsAnswer exam-style questions and get instant AI marking.
  • Mock exams & past-paper vaultSit full mocks and see exactly how examiners award marks.
  • Personalised study planA daily plan built around your exam date and weak areas.
Start Studying Free Full access to Aimnova Pro · cancel anytime
OverridingOverloading
Also calledRun-time (dynamic) polymorphismCompile-time (static) polymorphism
Same method name inParent and childOne class
Differs byWhich class the object isThe parameters supplied
DecidedWhen the program runsWhen it is compiled
ExampleCircle.area() against Rectangle.area()add(int, int) against add(double, double)
These are routinely confused: Overriding replaces a parent's method in a child — same signature, different class. Overloading defines several methods with the same name and different parameters in the same class.

An answer that swaps them loses the mark even when the example is right.
Static polymorphism in Python: Python has no true overloading: a second method with the same name replaces the first. The same effect comes from default parameters, e.g. def area(self, w, h=None). Java chooses between overloaded methods at compile time, which costs nothing when the program runs.

Learn what examiners really want

See exactly what to write to score full marks. Our AI shows you model answers and the key phrases examiners look for.

Try AI Feedback FreeYour first topic is free to keep • No credit card required

Code that does not change

  • A new subclass works with existing loops immediately
  • No if-chain to extend, so no chance of forgetting one
  • Adding behaviour without editing working code

One interface

  • Callers learn one method name, not one per type
  • The calling code reads as what it wants, not how each type does it

The alternative

  • Without it: a long if the type is Circle … otherwise if it is Rectangle chain
  • Every new type means editing every such chain
  • And every one you miss is a silent bug
Name what it replaces: The strongest polymorphism answer says what the code would look like without it: a type-checking if-chain that must be found and extended everywhere a new type is added.

How this is tested — you must show the same call behaving differently AND explain what it saves. It comes up two ways:

Paper 2 — working with code

  • Explain polymorphism, 3-4 marks
  • Distinguish overriding from overloading
  • State what a given call outputs

Paper 2 — the algorithmic-thinking question

  • Construct classes demonstrating it
  • Explain why it removes a type-checking chain
The classic trap: Describing inheritance and calling it polymorphism. Inheritance is sharing a method; polymorphism is the same call resolving differently per object. Show two different outputs from one line of code.

One unchanged call line reaching a different method as the object changes.

Interactive diagram

Explore the labelled diagram, charts and maps for this topic in full study mode.

Claim your free topic
IB-style questionExplain[5 marks]

A payments system handles CardPayment, BankTransfer and VoucherPayment, each processed differently. Explain how polymorphism lets one loop process a mixed list, and what it saves.

Model answer plan

See the answer broken into clear points, with guidance on how each point earns marks.

Claim your free topic

Try an IB Exam Question — Free AI Feedback

Test yourself on Polymorphism. Write your answer and get instant AI feedback — just like a real IB examiner.

the difference between method overriding and method overloading. [2 marks]

Related Computer Science HL Topics

Continue learning with these related topics from the same unit:

7.1.1Fundamentals of OOP7.1.2Designing classes7.1.3Static vs non-static7.1.4Classes and objects
View all Computer Science HL topics
Improve your exam techniqueCommand terms, paper structure, and mark-scheme tips for Computer Science HL
Previous7.2.1InheritanceNextAbstraction7.2.3

10 exam-style questions ready for you

Students who practice on Aimnova improve their scores by 15% on average. Get instant feedback that shows exactly how to improve your answers.

Practice Now — FreeView All Computer Science HL Topics