1 class A(object): 2 x = 1 3 4 class B(A): 5 pass 6 7 class C(A): 8 pass 9 10 #Modify the class attributes through the parent class, and the class attributes inherited by the subclass also change 11 Ax = 3 12 print (Ax, Bx, Cx) 13 #Modifying the class attributes inherited from the parent class by subclasses will only change the class attributes inherited by the subclass 14 Bx = 2 15 print (Ax, Bx, Cx) 16 #The subclass first modifies the inherited class attributes, and then the parent class modifies the class attributes, and will not make changes to the modified subclass attributes 17 Bx = 4 18 Ax = 1 19 print(A.x, B.x, C.x)