Discuss / Python / 实例属性和类属性 转载自https://blog.csdn.net/weixin_40585513/article/details/82778824

实例属性和类属性 转载自https://blog.csdn.net/weixin_40585513/article/details/82778824

class Student(object):

     count = 0

     def __init__(self, name):

               self.name = name

              Student.count +=1

       def get_count(object):

           return object.count


  • 1

Reply