You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
328 B
21 lines
328 B
class A:
|
|
def __init__(self, x):
|
|
print('A init', x)
|
|
self.x = x
|
|
|
|
def f(self):
|
|
print(self.x, self.y)
|
|
|
|
class B(A):
|
|
def __init__(self, x, y):
|
|
A.__init__(self, x)
|
|
print('B init', x, y)
|
|
self.y = y
|
|
|
|
def g(self):
|
|
print(self.x, self.y)
|
|
|
|
A(1)
|
|
b = B(1, 2)
|
|
b.f()
|
|
b.g()
|
|
|