1.2.4 OOP definitions Flashcards

(e)

You may prefer our related Brainscape-certified flashcards:
1
Q

what is a class?

A

a template for making an object

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

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

what is a constructor method?

A
  • __init__
  • creates an instance of an object
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is a public attribute?

A

accessible anywhere in the code

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

what is a protected attribute?

A

only accessible inside the class or subclass

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

what is a private attribute?

A

only accessible inside the class

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

what is encapsulation?

A

data hiding, making attributes private and only accessible via the public methods

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

what are the advantages of encapsulation?

A

1) stops accidental overwriting of attributes
2) allows validation before modifying attributes

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

what is inheritance?

A

where a subclass takes on the attributes of a superclass and can have additional attributes and methods

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

what is polymorphism?

A

redefining a method in a subclass with new behaviour

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