请问下这个哪里错了?报错
class Animal(object):
count = 0
def __init__(self, name):
self.name = name
Animal.count += 1
animal1 = Animal('Cat')
print(animal1.count)
animal2 = animal('Dog')
print(animal2.count)
class Animal(object):
count = 0
def __init__(self, name):
self.name = name
Animal.count += 1
animal1 = Animal('Cat')
print(animal1.count)
animal2 = animal('Dog')
print(animal2.count)
2021-02-07
举报