You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson covers the fundamental building blocks of Object-Oriented Programming (OOP) for the OCR A-Level Computer Science (H446) specification. You will learn about classes, objects, attributes, methods, constructors, and the this/self keyword.
A class is a blueprint or template that defines the structure and behaviour of a type of object. It specifies what attributes (data) and methods (behaviour) objects of that type will have.
An object is a specific instance of a class, created at runtime. Each object has its own set of attribute values.
| Term | Definition |
|---|---|
| Class | A template that defines attributes and methods for a type of object. |
| Object | A specific instance of a class, with its own attribute values. |
| Instantiation | The process of creating an object from a class. |
| Attribute | A variable belonging to an object that stores data about it. |
| Method | A function defined inside a class that operates on the object's data. |
CLASS Student
PRIVATE name: STRING
PRIVATE age: INTEGER
PRIVATE grades: ARRAY OF INTEGER
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.