1.2.4 - types of programming language Flashcards
11
class
A template defining methods and attributes used to make objects.
attribute
Data associated with the class.
method
A functionality of the class - something that it can do, or that can be done with it.
Why are attributes declared private and methods public?
Allows other classes to use methods belonging to another class but may not see or change their attributes.
information hiding
A class cannot directly access the attributes of another class when they are declared private.
constructor method
Used to create objects in a class.
instantiation
The creation of a new object (an instance of a class).
getter method
Functions that return the value of an attribute.
setter method
Procedures which change the state of an object.
encapsulation
Binds together the attributes and methods that manipulate the data.
inheritance
Classes can inherit data and behaviour from a parent class.
synonym for child class
subclass
synonym for parent class
superclass
polymorphism
A programming language’s ability to process objects differently depending on their class.
overriding
Defining a method with the same name and formal argument types as a method inherited
from a superclass.
opcode
Part of the instruction that indicates what to do.
mnemonic
A sequence of letters that is easy for a person to remember.
3 advantages of encapsulation
- reduces the chance of errors/ inconsistencies
- ensures objects can only be changed in the way intended
- protecting data
BRP
branch if zero or positive
Describe 2 benefits of using an object-oriented paradigm rather than a procedural paradigm.
- Code can easily be reused as classes can be used in other programs.
- Code can be more secure as access to attributes can be restricted via methods.
declarative language
A high-level language that states what is required but not how to do it. The statements do not have to be in a specific order.
State and explain one use of a declarative language. (2)
medical diagnosis: can find alternative solutions
Describe 3 features of an object-oriented language. (6)
- Self-contained object contains methods and attributes
- Uses encapsulation so the object can only be accessed through methods
- Inheritance allows a subclass to derive attributes and methods from its superclass