Object-Oriented Programming Flashcards

1
Q

class

A

A ‘blueprint’ to instantiate an object

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

object

A

The most basic type of thing, and any instance of some thing (e.g. object is an instance of a class)

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

instance

A

What you get when you tell Python to create from a class

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

def

A

Define a function inside a class

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

self

A

Inside the functions in a class, self is a variable for the instance/object being accessed.

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

inheritance

A

The concept that one class can inherit traits from another class

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

composition

A

The concept that a class can be composed of other classes as parts

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

attribute

A

A property that classes have, from composition and are usually variables

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

is-a

A

A phrase to say that something inherits from another

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

has-a

A

A phrase to say that something is composed of other things or has a trait

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

class X(Y)

A

Make a class named X that is-a Y

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

class X(object): def __init__(self, J)

A

Class X has-a __init__ that takes self and J parameters

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

class X(object): def M(self, J)

A

Class X has-a function named M that takes self and J parameters

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

foo = X()

A

Set foo to an instance of class X

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

foo.M(J)

A

From foo, get the M function, and call it with parameters self, J

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

foo.K = Q

A

From foo, get the K attribute, and set it to Q