[转]Python实现接口

class Interface:
def f1(self):
    raise Exception("子类需实现该方法")

class Sth(Interface):
pass

a = Sth()
a.f1()

你可能感兴趣的:(python)