Preview
IB DP Computer Science — B3 Object-oriented programming — Fundamentals of OOP for a single class | SL | B3.1.4
📋 What You Will Learn
- Construct a class definition: attributes, constructor and methods, in Java and Python
- Instantiate objects and call their methods through object references
- Explain the role of the constructor in initialising an object's state at creation
- Trace programs that create and use several objects of the same class
- Recognise that object variables hold references, and what that means when they are copied
🍪 Why This Matters A cookie cutter (the class) can stamp out any number of cookies (the objects). The moment each cookie is cut, it gets its shape and decoration — that first stamp-and-decorate step is the constructor. No cookie exists half-made: construction and initial state happen together.
Defining a Class
- A class definition has three parts: the attributes