一、方法和函数的区别 面向对象 初级
class StarkConfig(object): def __init__(self,model_class): self.model_class = model_class def changelist_view(self,request): return 123 class RoleConfig(StarkConfig): def changelist_view(self,request): return 666 obj1 = StarkConfig('xiao') obj2 = RoleConfig('zhang') ret1 = obj1.changelist_view(1) ret2 = obj2.changelist_view(2) print(ret1) print(ret2)