OOP Flashcards

1
Q

class

A

template for an object, defining the attributes and behaviours/methods of the objects in the class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

attributes/instance variables

A

data associated with a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

behaviour/methods

A

functionality of a class: something that it can do or can be done with it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

OOP

A

composed of a number of interacting objects, each of which is responsible for its own data and the operations on that data. Program code creates the objects and allows them to communicate and receive answers. All processing that is carried out in the program is done by the objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

information hiding

A

when a class cannot directly access the attributes of another class when they are declared private

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

why are attributes generally private and classes generally public

A

so classes can use methods belonging to other classes but cannot directly access or change their attributes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

constructor

A

procedure used to create objects in a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

instatiation

A

the creation and naming of a new object in a particular class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

keyword: new

A

used when declaring a constructor and instantiate a new object in a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

reference (type) variable

A

named memory location in which you can store information. it holds a pointer or reference to where the object is stored

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

in a variable reference diagram the circle and rectangle refers to..

A

circles: reference variables
rectangles: primitive data types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what are messages used for

A

to examine or change an object’s state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

getter messages

A

written as functions which return an answer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

setter messages

A

written as procedures which can change the state of an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

objects

A

instances of a class, which have the same structure methods and attributes but their own data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

encapsulation

A

both the data and methods are stored with an object in a single entity so the behaviour and methods of one object does not affect how another object functins

17
Q

whats so good about encapsulation

A

programmers can work on different parts without worrying how their code will affect others.
programmers can use methods from other classes without worrying about how they work

18
Q

variable reference diagram

A

shows in graphical form an object referenced by a reference variable

19
Q

inheritance

A

when a subclass inherits/shares attributes/methods with its superclass but with their own data and extra methods.

20
Q

what does in inheritance diagram look like

A

has unfilled arrows pointing up towards superclass

21
Q

polymorphism

A

refers to a programming language’s ability to process objects differently depending on their class, despite methods having the same name.

22
Q

overriding

A

defining a method with the same name and formal argument types as an inherited method from a superclass

23
Q

code: defining a class and attributes

A

class Animal
private name
private position

24
Q

code: defining a procedure

A

public procedure new ( x, y, z)
aX = x
endprocedure
(new only if constructor)

25
Q

code: an object which is inheriting another objects properties

A
class mouse inherits Animal
private squeakNoise
public function squeak
...
endfunction
26
Q

how to access private attributes of another object

A

through functions/procedures: getter/setter

27
Q

if you want to use superclass’ methods, eg called stackSize, how do you do this

A

super.new(Stacksize)