aimnova.
DashboardMy LearningPaper MasteryStudy 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
  • Flashcards
  • Revision Guide
  • Exam Skills
  • Command Terms
  • Grade Calculator
  • Exam Timetable 2026

Aimnova

  • Features
  • Pricing
  • For Schools
  • For Parents
  • About Us
  • Blog
  • Contact
aimnova.

AI-powered study platform for smarter revision, past-paper analysis and examiner-style feedback.

TermsPrivacyCookies·© 2026 Aimnova. All rights reserved.8afc4e3

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

NotesComputer Science HLTopic 7.2
Unit 7 · Object-oriented programming · Topic 7.2

IB Computer Science HL — OOP: multiple classes

Fundamentals of OOP for multiple classes

Higher Level students should use this topic hub as a map: start with the shared sub-topics, then follow the HL-only extensions and exam-skill links where this topic asks for deeper analysis.

Exam technique guidePractice questions

Key concepts in OOP: multiple classes

Key Idea: A single class holds its own data and rules. Multiple classes have to relate to each other — and choosing the wrong relationship is the most expensive mistake in object-oriented design, because everything built on it inherits the error.

Paper 1

  • Define inheritance, polymorphism, abstraction.
  • Classify a relationship; name a pattern.

Paper 2

  • Design a hierarchy and justify it.
  • Construct code showing polymorphism.

Both

  • The justification is the marks — say what the alternative would break.

🧬 Choosing the relationship

RelationshipTestExample
Inheritance"A is a B"SavingsAccount is an Account
Composition"A has a B", and owns itHouse has Rooms
Aggregation"A has a B", which survives itCourse has Students
First the is-a test: say the sentence aloud. If it is absurd, inheritance is wrong. Then, for has-a, the survival test: delete the whole — does the part still make sense? Yes is aggregation, no is composition.
Important: Reaching for inheritance because a class happens to have methods you want brings everything else it has too, and couples you to its internals. Composition gives you only what you asked for.

🎭 Polymorphism

What it is, and what it replaces

  • The same call behaving differently depending on the object it is made on
  • Overriding — child replaces a parent's method, resolved at run time
  • Overloading — one name, different parameters, one class, resolved at compile time
  • It replaces a type-checking if-chain, repeated everywhere the objects are handled
  • A new subclass works with existing loops immediately — no working code is edited

🫥 Abstraction

AbstractionEncapsulation
AsksWhat should be visible?How is it protected?
Is aboutDesign — the interfaceImplementation — access control
Achieved withAbstract classes, interfacesprivate, protected, getters
In one lineDecidesEnforces
Its abstract methods have no bodies. An object of it could be asked to run a method that does not exist, so the language refuses. It is a promise about children, not a thing.

🧩 Design patterns

PatternPurposeWhat it removes
SingletonExactly one instanceDuplicate, inconsistent instances — at the cost of global state
FactoryDecides which subclass to createConcrete class names scattered everywhere
ObserverSubscribers notified on changeThe subject knowing who is listening
StrategyInterchangeable algorithmsAn if-chain selecting behaviour

📝 Exam-style questions

IB-style questionConstruct[6 marks]

A delivery company tracks Vans and Bicycles. Both have an ID, a driver and a current location; a Van also has a load capacity and fuel level, a Bicycle a battery level. Every vehicle reports its status, but each does so differently. Construct a design and justify the relationships used.

🔒 Model answer plan

See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.

Claim your free topic →
IB-style questionExplain[4 marks]

Explain why an interface is preferred to an abstract class when unrelated classes must all be saveable to disc.

🔒 Model answer plan

See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.

Claim your free topic →

✅ Quick check

Cover the answers.

Which two tests decide a relationship? is-a for inheritance, then the survival test for has-a: delete the whole, does the part still make sense?

Overriding or overloading — same class, different parameters? Overloading, resolved at compile time. Overriding is a child replacing a parent's method, at run time.

Abstraction or encapsulation — which decides, which enforces? Abstraction decides what should be visible. Encapsulation enforces it.

What does the observer pattern remove? The subject having to know who is listening — so new observers need no change to it.

Why does polymorphism mean no working code breaks? A new subclass works with existing loops immediately, so nothing that currently works is edited.


Exam tips

  • Say the is-a sentence aloud before claiming inheritance.
  • Justify with BOTH the relationship and what duplication would cost.
  • Show ONE call giving different outputs — that is the evidence for polymorphism.
  • Abstraction decides, encapsulation enforces. Never swap them.
  • Name what a pattern REMOVES, not just what it is.
  • A drawback, honestly given, frequently scores a mark on its own.

What you'll learn in Topic 7.2

  • 7.2.1 Inheritance
  • 7.2.2 Polymorphism
  • 7.2.3 Abstraction
  • 7.2.4 Composition and aggregation
  • 7.2.5 Design patterns
Suggested study order: Read the notes for each sub-topic below → test yourself with flashcards → attempt practice questions → review exam technique.

Study resources — 7.2 OOP: multiple classes

7.2.1

Inheritance

Notes
7.2.2

Polymorphism

Notes
7.2.3

Abstraction

Notes
7.2.4

Composition and aggregation

Notes
7.2.5

Design patterns

Notes

Ready to study OOP: multiple classes?

Get expert practice questions with instant AI feedback, and a study planner tailored to your IB Computer Science HL exam date.

Start studying free

Topic 7.2 OOP: multiple classes forms a core part of Unit 7: Object-oriented programming in IB Computer Science HL. Mastering these concepts will strengthen your understanding of connected topics across the syllabus and prepare you for exam questions that require analysis, evaluation, and real-world application.

Previous topic
7.1 OOP: a single class
Next topic
8.1 Fundamentals of ADTs
All Computer Science HL topics
Exam technique

Ready to practice?

Get AI-graded practice questions, mock exams, flashcards, and a personalised study plan — all aligned to your IB syllabus.

Start Studying Free

No credit card required · No time limit