Someone had the same problem on this site, but the answer did not concern the part with which I have problems.
Inheritance - method invocation
Consider the following class definitions.
class C1(object):
def f(self):
return 2*self.g()
def g(self):
return 2
class C2(C1):
def f(self):
return 3*self.g()
class C3(C1):
def g(self):
return 5
class C4(C3):
def f(self):
return 7*self.g()
obj1 = C1()
obj2 = C2()
obj3 = C3()
obj4 = C4()
For this task, you should consider what methods are called when the method is called f. So, for example, when called obj1.f(), a method f C1is called that calls the method g C1. This can be represented as a βcall listβ form
['C1.f', 'C1.g']
, " " obj2.f() obj2_calls, " " obj3.f() obj3_calls " " ' obj4.f() obj4_calls.
, obj2_calls = ['C2.f', 'C1.g']
, . , C3.f, ['C1.f'], , , .
, ,