IT 117: Intermediate Scripting
Answers to Class 23 Ungraded Quiz
If I wanted to define the class Cat
which is a based upon the class Pet, what would
I write for a class header?
Let's say that the constructor for the Pet
class takes only 1 argument, the name of the pet. Write the Python
statement you would use to call the Pet
constructor within the Cat constructor
If I wanted to call the __str__ method
of the Pet class inside a method in
the Cat class, what expression
would I write?
Let's say that both the Pet class and the
Cat class have a method named
get_name. If we call
get_name on a Cat
object, which class's version of this function will be used?
If I had a variable named var that pointed
to an object and wanted to know whether this was an instance of the
class Cat, what boolean expression would