class nested(Coordinate):
def __init__(self, x, y, parent=None):
super().__init__(x, y)
self.parent = parent
def getX(self):
if self.parent:
return self.parent.x + self.x
return self.x
class Base:
def __init__(self):
self.testfield = 'testfield'
class Child(Base):
def __init__(self):
super().__init__() # рискни это закомментировать
pass
a = Child()
print(a.testfield)
class Base(list):
def __init__(self):
self.testfield = 'testfield'
class Child(Base):
def __init__(self, aname):
super().__init__()
self.name = aname
a = Child('lala')
print(a)
print(a.name)