0
Is Cat is a object or felix , rover , stump are objects or both Cat , felix, rover,stumpy are objects ?
class Cat: def __init__(self, color, legs): self.color = color self.legs = legs felix = Cat("ginger", 4) rover = Cat("dog-colored", 4) stumpy = Cat("brown", 3)
2 Respuestas
+ 7
Cat is a class and felix, rover and stumpy are objects.
+ 1
Remember, think of the class as a blueprint or "plans" for an object.
felix, rover, and stumpy are all INSTANCES of the class