Computing - Object Oriented Programming
What is a class?
A blueprint or template for a type of object.
What are the data of an object called?
Attributes.
What are the operations that you can perform on object called?
Methods.
What is instantiation?
Creating an object from a class.
What is the concept of encapsulation?
Attributes and methods are wrapped into a single entity.
What is inheritance?
Where subclasses use attributes and methods of it’s superclass.
What is the Python syntax for initialising the superclass?
super().__init__(params...)
2021-11-08
What is a “record” pretty similar too?
A class.
2022-06-05
Does an object or a class define methods in OOP?
A class.
What is an object?
A specific instance of a class.
What are the three sections of a class in a class diagram?
What do the direction of arrows show in a class diagram?
Source inherits destination.
What does a “+” mean in a class diagram?
This is a public method/attribute.
What does a “-“ mean in a class diagram?
This is a private method/attribute.
What is the difference between private and protected methods/attributes?
Private means it can only be accessed inside the class where it’s defined, whereas protected means it can be accessed by all subclasses too.
What is polymorphism?
The ability of different types of data to be manipulated with the same method.
What is overriding?
Where a method in a subclass takes precedence over a method with the same name in the base class.
What is a static method?
A method that can be used without an object of the class being instantiated.
What is a virtual method?
A method defined in the base class that can be overridden in the subclass.
What is an abstract method?
A method not supplied in the base class but defined in the subclass.
What is an example of an abstract method in the skeleton program?
The Process
method for a card.
What is aggregation in OOP?
Creating objects that contain other sorts of objects.
What is composition aggregation?
Creating objects that contains other objects, with the children objects dependent on the parent objects for their existence.
What is association aggregation?
Creating objects that contain other objects, with the children being able to survive if the parent doesn’t exist.
Which type of aggregation means that children will still exist if the parent doesn’t exist?
Association aggregation.
What type of aggregation means that children won’t exist if the parent doesn’t exist?
Composition aggregation.
What type of aggregation is represented by a solid black diamond?
Composition aggregation.
What type of aggregation is represented by a hollow diamond?
Association aggregation.