#coding=utf-8
class base(object):
    def test(self):
        print('----base test----')
class A(base):
    def test(self):
        print('----A test----')

# 定义一个父类
class B(base):
    def test(self):
        print('----B test----')

# 定义一个子类,继承自A、B
class C(A,B):
    pass


obj_C = C()
obj_C.test()

print(C.__mro__)  # 查看继承顺序

  

相关文章:

  • 2022-03-11
  • 2021-09-13
  • 2022-12-23
  • 2022-01-19
猜你喜欢
  • 2021-05-03
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
  • 2021-09-21
相关资源
相似解决方案