Skip to content
Learnearn.uk » A Level Computer Science Home » Object Orientated Programming

Object Orientated Programming

Classes & Instances

Class

A class is a blueprint/blueprint for an object.

  • Object / Instance
  • Objects are what the blueprint makes.
  • An instance is an individual object.
  • Objects & Instances are widely used interchangeably.
  • A blueprint for a house design is like a class description. All the houses built from that blueprint are objects of that class. A given house is an instance.

Properties / Attributes

 

Methods

 

Getters & Setters

Getters & Setters

 

Inheritance

Inheritance

This feature of OOP is where a subclass inherits a feature (either a method or attribute) from the parent class.

 

class MotorVehicle:
    def __init__(self):
        self.wheels = 4

class Car(MotorVehicle):
    def __init__(self):
        MotorVehicle.__init__()
car = Car()
print(car.wheels)
#Here Car inherits the wheels attribute from the parent class.

Poly-morphism

Poly-morphism

Containment / Aggregation

Containment / Aggregation

 

 

Project Ideas

Resources

Teacher Presentation

 

Past Paper Questions

Winter 19 Paper 41  – Question 1C