File tree Expand file tree Collapse file tree 1 file changed +47
-9
lines changed Expand file tree Collapse file tree 1 file changed +47
-9
lines changed Original file line number Diff line number Diff line change 1
1
2
- class A (object ):
2
+ class Father (object ):
3
3
4
4
def __init__ (self , a , b ):
5
5
self .a = a
6
6
self .b = b
7
7
8
- def m1 (self ):
9
- print "inside A"
8
+ def role (self ):
9
+ print ( "Father of two childres" )
10
10
11
- class B (A ):
11
+ def occupation (self ):
12
+ print ("Father is working in Bank" )
12
13
13
- def __init__ (self ):
14
+ def travellingIn (self ):
15
+ print ("As a father, I use Audi Car to go office" )
16
+
17
+ class Mother (Father ):
18
+
19
+ def __init__ (self ,):
14
20
print ("b constructor" )
15
- # def m1(self):
16
- # print "inside b"
17
21
18
- bb = B ()
19
- bb .m1 ()
22
+ def role (self ):
23
+ print ("Mother of Two childrens" )
24
+
25
+ def occupation (self ):
26
+ print ("Home maker" )
27
+
28
+ def whatCooking (self ):
29
+ print ("Mother is preparing Pasta!" )
30
+
31
+ # creating an object of mother.
32
+ instanceOfMother = Mother ()
33
+
34
+ instanceOfMother .role ()
35
+
36
+ instanceOfMother .occupation ()
37
+
38
+ instanceOfMother .whatCooking ()
39
+
40
+ instanceOfMother .travellingIn ()
41
+
42
+
43
+ # creating an object of Father
44
+
45
+ fatherInstance = Father (10 ,20 )
46
+
47
+ fatherInstance .role ()
48
+
49
+ fatherInstance .travellingIn ()
50
+
51
+ fatherInstance .occupation ()
52
+
53
+ fatherInstance .whatCooking ()
54
+
55
+
56
+ # how about this?
57
+ print (bb .a )
You can’t perform that action at this time.
0 commit comments