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
Dictionary example
31 dec dil khush
ACII_Art
http
Game2
time module time.time()
Patterns
Ghost 👻👻👻👻👻 Game 👻👻👻👻👻👻
Rene
количество 1 и 0 в последовательности чисел до n