Skip to content
Marlbridge

Flashcards · 9645 · A Level Topic 9

Object-oriented and additional programming (A Level) flashcards

8 cards on A Level Topic 9. Pick a subtopic or study them all.

Study mode needs JavaScript. Every card is listed below, so you can still cover the answers and test yourself.

All 8 cards

For a quick read-through or printing. Cover the right-hand side to test yourself.

Topic 9: Object-oriented and additional programming

Class vs object
A class defines the attributes and methods common to a type of object; it is written once. An object is one instance of a class, with its own attribute values.
What are instantiation and a constructor?
Instantiation is creating an object from a class. The constructor is called on instantiation and initialises the object to a given state.
What is encapsulation?
Hiding how a class works and how it represents data from other classes, usually by making attributes private and accessing them through methods.
What are inheritance and overriding?
Inheritance: one class is a more specialised version of an existing class. Overriding: a base-class method is redefined in a subclass so subclass objects behave differently.
Inheritance vs association
"Is a more specialised kind of" means inheritance. "Uses" or "has a link to" means association, which is much weaker. A Ward is associated with its Patients; it is not a kind of Patient.
Public, private and protected access modifiers
Public (+): accessible from anywhere. Private (−): the class only. Protected (#): the class and its subclasses.
How are private and protected members written in Python?
Private: a double underscore prefix, which triggers name mangling. Protected: a single underscore prefix, which is a convention only.
Why use the object-oriented paradigm?
It models problems as interacting objects, protects data behind methods, lets subclasses reuse tested code, and lets each class be built and tested separately.