Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
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
Please
log in
to post a comment.
isipadu kuboid
super
inverse matrix gauss jordan
Calender 2019
Multi-Layer Neural Networks
List problem - add items
Search for sum of pairs in given array
L4-HW final
restraunt score
Guessing game
Please log in to post a comment.