zoukankan      html  css  js  c++  java
  • 2.29多继承

    #多重继承
    #多继承:子类有多个父类 所有类的父类都是对象
    class A :
        def test(self):
            print('A--------------test')
    class B:
        def test(self):
            print('B--------------test')
    class C(A,B):# A,B的位置决定调用方法的优先级
        def test1(self):
            print('c----------test')
    
    
    c = C()
    
    
    c.test()
    #output:A--------------test 优先调用父类A类里的test
    #print(c#output:<__main__.C object at 0x00000000028DA7C8>
    #所有类的父类都是object,即对象
    #没有直接的继承关系,可以这么定义类class A(object):
  • 相关阅读:
    感想2
    感想1
    记录4
    记录3
    记录2
    记录1
    库存物资管理系统-测试
    开学测试
    大二下开学测试有感
    大二下周总结一
  • 原文地址:https://www.cnblogs.com/yescarf/p/12907066.html
Copyright © 2011-2022 走看看