I don't understand why the code uses the print_me method from Class D, and not the method in class A.
I did some testing using print-statements and can see that it reads the print_me-method of class D before initialising class A, but I don't understand why it doesn't do the same for class A.
class A:
name = "Alfa"
def __init__(self, foo):
self.foo = foo
foo = 100
self.print_me()
def print_me(self):
print(self.name, self.foo)
class B(A):
name = "Beta"
def __init__(self, bar = 40):
self.bar = bar
print(self.name, bar)
class C:
name = "Charlie"
class D(A, C):
name = "Delta"
def __init__(self, val):
A.__init__(self, val)
def print_me(self):
print(self.name, "says", self.foo)
d = D(60)
The output is: Delta says 60
I thought it would be: Delta 60