class A:
def __init__(self):
self.__x = 1
def get_x(self):
return self.__x
class B(A):
def __init__(self):
super().__init__()
self.__x = 2
b = B()
print(b.get_x())
💕 Наш уютный чатик
#Python
PY Python | Тесты для программистов @pythontest_it · 15K subscribers class A:
def __init__(self):
self.__x = 1
def get_x(self):
return self.__x
class B(A):
def __init__(self):
super().__init__()
self.__x = 2
b = B()
print(b.get_x())