Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Inheritance.py
#python 3.5.2 #single inheritance class Parent: def f1(self): print('Parent f1 working') class Child(Parent): def f2(self): print('Child f2 working') p=Parent() p.f1() c=Child() c.f1() c.f2() #Multilevel inheritance class GrandParent: def f1(self): print('GrandParent f1 working') class Parent(GrandParent): def f2(self): print('Parent f2 working') class Child(Parent): def f3(self): print('Child f3 working') gp=GrandParent() gp.f1() p=Parent() p.f1() p.f2() c=Child() c.f1() c.f2() c.f3() #Mutiple inheritance class Parent1: def f1(self): print('Parent1 f1 working') class Parent2: def f2(self): print('Parent2 f2 working') class Child(Parent1,Parent2): def f(self): print('Child f working') p1=Parent1() p1.f1() p2=Parent2() p2.f2() c=Child() c.f() c.f1() c.f2()
run
|
edit
|
history
|
help
0
myone
Python: String to Brainfuck
sen
Q2
Lesson 7 part 2
Python
0403_diamond
Lesson#6
I_Love_India
あだだだだだだだだだだだだだだだだだだだだだだだだ