0

I'm learning python.I met a confused.

Here is ther first script A.py

#!/bin/env python

class A():
    def test(self):
        print("A.Func")

class B(A):
    pass

class C(A):
    def test(self):
        print("C.Func")

class D(B,C):
    pass

d = D()
d.test()

Result:A.Func

and another python script B.py

The difference between A.py and B.py is class A.

#!/bin/env python

class A(object):
    def test(self):
        print("A.Func")

class B(A):
    pass

class C(A):
    def test(self):
        print("C.Func")

class D(B,C):
    pass

d = D()
d.test()

Result:C.Func

Why?

0 Answers0