I want to know how I can (in a class) use another class' method.
Here's an example (which is not working):
Here's an example (which is not working):
Code:
class A:
def __init__(self, x, y):
self.x = x
self.y = y
class B(A):
def __init__(self, x, y, z):
self.z = z
def add(self):
result = self.x + self.y + self.z
class C(B):
def __init__(self, x):
self.x = x
while 1==1:
B.add()
result += self.x
print result
A = A(1,2)
B = B(1,2,3)
C = C(1)
Comment