class people:
    age = 10
    name = "liming"
age和name是全局的,修改people类的对象中的age和name会使类中相应的变量发生改变。
class Employee:
   ‘所有员工的基类‘
   empCount = 0
 
   def __init__(self, name, salary):
      self.name = name
      self.salary = salary
      Employee.empCount += 1
注意其中私有和全局的变量的定义,这样写才是常规写法。
init()是构造函数
原文:https://www.cnblogs.com/lanhongfu/p/15110610.html