1# =============================================================================
2# Inhertance
3# =============================================================================
4class A:
5 def feature1(self):
6 print('Feature 1 in process...')
7 def feature2(self):
8 print('Feature 2 in process...') #Pt.1
9
10class B:
11 def feature3(self):
12 print('Feature 3 in process...')
13 def feature4(self):
14 print ('Feature 4 in process...')
15
16a1 = A()
17
18a1.feature1()
19a1.feature2()
20
21a2 = B()
22
23a2.feature3()
24a2.feature4()
25# THE ABOVE PROGRAM IS A PROGRAM WITHOUT USING INHERITANCE
26
27# WITH THE USE OF INHERITANCE IS BELOW
28class A:
29 def feature1(self):
30 print('Feature 1 in process...')
31 def feature2(self):
32 print('Feature 2 in process...')
33
34class B(A):
35 def feature3(self):
36 print('Feature 3 in process...') # Pt.2
37 def feature4(self):
38 print ('Feature 4 in process...')
39
40a1 = A()
41
42a1.feature1()
43a1.feature2()
44
45a2 = B()
46
47a2.feature3()
48a2.feature4()
49
50
51# NOW TO CHECK OUT THE DIFFERENCE BETWEEN Pt.1
52# AND Pt.2 TRY RUNNIG THE CODE ON THE BASIS OF
53# INHERITANCE, IN OTHER WORDS TRY RUNNING ONLY
54# B CLASS IN Pt.2 AND THEN RUN ONLY a2
55# YOU WILL SEE A DIFFERENCE IN THE RUNNING OF
56# ONLY a2,,,, IT WILL STILL SHOW THAT FEATURE 3
57# AND 4 IS IN PROCESS,, THIS MEANS THAT B IS THE