1.2.4 Types of Programming Language (Object-Oriented Programming) Flashcards
(13 cards)
What is a class?
The blueprint for defining methods and attributes that can be used to create objects
What is an object?
An instance of a class, it holds specific data values for the class attributes.
What is a method?
They are procedures/functions defined inside a class.
What actions an object can do
What is an attribute?
Attributes are variables inside a class.
What an object is or has
What are the two types of attributes?
1) Private attributes → only accessible within the class
2) Public attributes → accessible from outside the class (less common)
Why are attributes usually kept private?
- To protect the data
- Use encapsulation by controlling access through methods
What is encapsulation?
The bundling of methods and attributes into a class
What is inheritance?
The concept that subclasses can inherit methods and attributes from its parent class (e.g. super)
What is polymorphism?
The concept that allows objects to take on different forms
How is encapsulation implemented in pseudocode?
Restricting access using private and public with getters/setters
What is a getter method?
A public function used to retrieve the value of a private attribute.
What is a setter method?
A public procedure used to change the value of a private attribute.
What is method overriding?
When a subclass defines a method with the same name as one in its superclass to provide specific behaviour.