考虑如下的定义类时,类之间的多继承关系,要求:(1)根据类定义的关系画出继承关系图;(2)类D的mro属性值是多少? >>>class A1: pass >>>class A2: pass >>>class A3: pass >>>class B1(A1,A2): pass >>>class B2(A2,A3): pass >>>class B3(A3): pass >>>class C1(B1): pass >>>class C2(B1,B2): pass >>>class C3(B2,B3): pass >>>class D(C1,C2,C3): pass
时间: 2023-08-07 22:32:25 浏览: 125
继承关系图如下:
```
A1 A2 A3
\ | /
\ | /
\ | /
\ | /
\ | /
\|/
B1
/ | \
/ | \
/ | \
/ | \
/ | \
C1 B2 C3
\ / \ /
\ / \ /
C2 B3
\ /
\ /
D
```
类D的mro属性值是:D -> C1 -> B1 -> C2 -> B2 -> C3 -> B3 -> A3 -> A2 -> A1 -> object
阅读全文