First page Back Continue Last page Overview Graphics

“Solution” for the problem

We could overload m() in D as well, and call m() of B and C exlicitly:

class A(object):

def m(self):

print("m in A")

class B(A):

def m(self):

A.m(self)

print("m in B")

class C(A):

def m(self):

A.m(self)

print("m in C")

class D(B,C):

def m(self):

B.m(self)

C.m(self)

d = D()

d.m()

We get the following output:

m in A

m in B

m in A

m in C