fork download
  1. class Class1(object):
  2. def method1(self): return 'm1'
  3. c1 = Class1()
  4. print(c1, c1.method1())
  5.  
  6. class Class3(Class1):
  7. def method2(self): return 'm2'
  8. c3 = Class3()
  9. print(c3, c3.method1())
  10. print(c3, c3.method2())
  11.  
  12. class Class2(object):
  13. def method1(self): return 'm1'
  14. def method2(self): return 'm2'
  15. c2 = Class2()
  16. print(c2, c2.method1())
  17. print(c2, c2.method2())
  18.  
Success #stdin #stdout 0.02s 8688KB
stdin
Standard input is empty
stdout
<__main__.Class1 object at 0xb757dfec> m1
<__main__.Class3 object at 0xb758704c> m1
<__main__.Class3 object at 0xb758704c> m2
<__main__.Class2 object at 0xb758708c> m1
<__main__.Class2 object at 0xb758708c> m2