-
Getters and Setters
Which of the below is a getter method for the number of wheels?
--------------------------------------------- Given ----------------------------------------------class Car(object):def __init__(self, w, d):self.wheels = wself.doors = dself.color = ""----------------------------------(A) def get_wheels():return wheels(B) def get_wheels():return self.wheels(C) def get_wheels(self):return wheels(D) def get_wheels(self):return self.wheels -
Subclass
Whate line could replace
____blank____to create a class that inherets fromAnimalin the code below?____blank____def speak(self):print("ruff ruff")(line1) d = Dog(7)(line2) d.set_name("Ruffles")(line3) d.speak()
With this definition of Dog, you run a program with line1, line2, and line3 above. What happens? Refer to the lecture slides for the code making up the "Animal" class.
