object oreinted p[roggreamoing Flashcards

1
Q

What is a class

A

a template for an object it includes attributes

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

what is an object

A

an instance of a class. objects have attributes

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

what is a method

A

a method is a function or procedure that gives functionality to an object. methods have attributes

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

what is a constructor

A

a method that runs when the object is first instated, giving attributes an initial value.

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

what is the difference between a record and a class

A

Records can only access attributes directly, whereas classes can only access attributes through a method.

re use or a records code is tricky
re use of a classes code is easy

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

what is an attribute

A

a data structure that holds a value for each object (like a variable)

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

inheritance

A

when a sub-class takes on the attributes and methods of a superclass

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

Encapsulation

A

all attributes are private they are only accessible through methods. this makes the code more robust

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

polymorphism

A

occurs when a super class and a subclass both have methods with the same identifier. the sub class overrides the superclass method because of polymorphism

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

What is abstraction? What are the pros?

A

(Is when we hide unnecessary detail from a problem.)
The simplification of a problem, for example objects might show up as simple shapes

+Easier to /understand
+Might use less memory
+Reality creates many unneeded details
+Reduces complexity of program code and therefore can run on lower spec computers

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

Overloading (in polymorphism )

A

When two or more methods have the same identifier name (within the same class) then the correct method is used depending on the number of parameters

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