Skip to content

Instantly share code, notes, and snippets.

@HajimeKawahara
Created April 5, 2023 23:30
Show Gist options
  • Save HajimeKawahara/422c3b5700b945e069f9da42ce1614f1 to your computer and use it in GitHub Desktop.
Save HajimeKawahara/422c3b5700b945e069f9da42ce1614f1 to your computer and use it in GitHub Desktop.
class ClassChild1():
def __init__(self, initc):
self.c = initc
def func_c(self):
self.c = self.c/5.0
class ClassChild2():
def __init__(self, initd):
self.d = 1.0 + initd
def func_d(self):
self.d = self.d/2.0
class ClassParent(ClassChild1, ClassChild2):
def __init__(self):
self.a = 1.0
ClassChild1.__init__(self, 1.0)
ClassChild2.__init__(self, 2.0)
def func_a(self):
self.a = self.a/10.0
if __name__ == "__main__":
cls = ClassParent()
print(cls.a, cls.c, cls.d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment