OOP is a programming paradigm that organises software as a collection of objects. Each object combines data (attributes) and the operations that act on it (methods). OOP reflects real-world modelling and promotes reuse and modularity.
A class is a blueprint/template that defines what attributes and methods objects of that type will have. An object (or instance) is a specific realisation of a class in memory.
| Concept | Definition | Example |
|---|---|---|
| Class | Blueprint defining attributes and methods | class Car: |
| Object/Instance | Specific realisation of a class | myCar = Car() |
| Attribute | Data stored in an object (instance variable) | myCar.colour = "red" |
| Method | Function belonging to a class | myCar.start() |
| Constructor | Special method called when object is created (__init__) | Sets initial attribute values |
Bundling data (attributes) and methods together inside a class, and restricting direct access to internal data from outside. Private attributes are only accessible via public methods (getters/setters).
A subclass (child class) inherits attributes and methods from a superclass (parent class). The subclass can add new attributes/methods or override inherited ones. Enables code reuse.
ElectricCar extends Car — inherits speed, colour, start(), and adds batteryLevelThe same method name can behave differently depending on the object it is called on. Different classes can implement the same interface in their own way.
speak() method — a Dog object returns "Woof", a Cat object returns "Meow"Hiding complex implementation details and exposing only what is necessary to the user. Users interact with a simplified interface without needing to understand internal mechanics.
car.start() — you don't need to know how the ignition system works8 questions · instantly marked · AQA 7517 standard
class Car [1]. Object/instance: a specific realisation of a class created in memory with its own attribute values [1]; example: myCar = Car() where myCar is one specific car object [1].| Term | Definition |
|---|
10 questions · 10 minutes