Search This Blog

Python: overriding static method


class A:
@staticmethod
def m():
print "A"

class B(A):
@staticmethod
def m():
print "B"

a = A()
a.m() # A
b = B()
b.m() # B

No comments:

Post a Comment