Discuss / Python / 为什么类方法里面调用类属性count 要加个Student.啊?

为什么类方法里面调用类属性count 要加个Student.啊?

Topic source

zhr305

#1 Created at ... [Delete] [Delete and Lock User]

class Student(object):

    count = 0

    def __init__(self, name):

        self.name = name

        Student.count = Student.count + 1


  • 1

Reply