Speak Object-Oriented Flashcards
1
Q
“Make a class named ??? that is-a Y.”
A
class X(Y)
2
Q
“Class ??? has-a __init__ that takes self and ??? parameters.”
A
class X(object): def __init__(self, J)
3
Q
“Class ??? has-a function named ??? that takes self and ??? parameters.”
A
class X(object): def M(self, J)
4
Q
“Set ??? to an instance of class ???.”
A
foo = X()
5
Q
“From ???, get the ??? function, and call it with self=??? and parameters ???.”
A
foo.M(J)
6
Q
“From ???, get the ??? attribute, and set it to ???.”
A
foo.K = Q