-
-
Save podhmo/b3be44a1950a366048e341ece9c481cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A: | |
def __init__(self): | |
self.__c = 1 | |
def a(self): | |
self.__c += 1 | |
def show(self): | |
print(f"{self=} a.c is {self.__c=}") | |
class B(A): | |
def __init__(self): | |
super().__init__() | |
self.__c = 10 | |
def b(self): | |
self.__c += 10 | |
def show(self): | |
super().show() | |
print(f"{self=} b.c is {self.__c=}") | |
b = B() | |
b.show() | |
b.b() | |
b.b() | |
b.a() | |
print() | |
b.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment