@staticmethod
声明该函数为类中的静态函数,为所有的实例对象所共有
class A:
total = 0
def fun1(self):
A.total += 1
print('父类正在被调用')
'''
定义一个静态函数(静态方法)
使用@staticmethod
'''
@staticmethod
def staticfunc():
print('正在调用静态函数')
class B(A):
def func2(self):
# A.fun1(self)
# super().fun1()
self.fun1()
A.total += 1
print('子类正在被调用')
# temp = B().func2()
# a = A().fun1()
#
# print(A.total)
a = A()
a.staticfunc()