B3.2 Fundamentals of OOP for multiple classesB3.2.2
Polymorphism — Static (Method Overloading) and Dynamic (Method Overriding)
Construct code to model polymorphism and its various forms, such as method overriding
AHL≈ 60 minCommand term: ConstructPremium
In this lesson
- Explaining polymorphism and how it makes code flexible and reusable
- Constructing dynamic polymorphism with method overriding, including calling the superclass version
- Applying static polymorphism with method overloading (and its Python equivalent)
- Tracing which version of a method runs for objects in a superclass-typed list
This lesson is part of Premium
Every topic has one free lesson. Premium unlocks every interactive lesson, the exam-style questions at the end of each one, and the rest of Praxis IB.
What's inside
- LearnOne call, many forms
- CodeOverriding a method
- LabWhich version runs?
- LearnStatic polymorphism: overloading
- CodeOverloading in Java, a default parameter in Python
- LearnOverriding and overloading
- CheckOverriding or overloading?
- CheckQuick check
- ExamWorked exam answer
- ReviewMistakes examiners see
- Exam practiceExam-style questions
Ends with 4 exam-style questions worth 11 marks, with a self-marking markscheme.