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)

18th Nov 2020, 6:45 AM
Rajan K
Rajan K - avatar
2 Respostas
+ 7
Cat is a class and felix, rover and stumpy are objects.
18th Nov 2020, 7:15 AM
Pranav
Pranav - avatar
+ 1
Remember, think of the class as a blueprint or "plans" for an object. felix, rover, and stumpy are all INSTANCES of the class
18th Nov 2020, 10:18 AM
Slick
Slick - avatar