class A(): def test(self): print("A --- test方法") def demo(self): print("A --- demo方法") class B(): def test(self): print("B --- test方法") def demo(self): print("B --- demo方法") class C(A, B): pass c = C() c.demo() c.test() print(dir(c))
python 多继承-父类有同名方法,建议不用多继承
最新推荐文章于 2022-08-26 15:47:43 发布