-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpy_lab_ex_4.py
58 lines (44 loc) · 1.29 KB
/
py_lab_ex_4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#single inheritance
class library():
name="kavaskar"
def __init__(self):
print("hello this is library")
def display(self):
print("hello i am a library")
class librarian(library):
def __init__(self):
print("librarian here")
def display(self):
print("hello this is librarian")
#multilevel inheritance
class librarian_det(librarian):
def __init__(self):
print("librarian details here")
def display(self):
print("hello here you can able to find the librarian details")
#multiple inheritance
class author():
def __init__(self):
print("author here")
def display(self):
print("hello i will have the details about any authors")
class books(library,author):
def __init__(self):
print("books here")
def __init__(self):
print("hello i am having the details of both the library and the authors")
#hirarchial inehritance
class user(library):
def __init__(self):
print("user here")
def display(self):
print("hello i am the user reading book is my hobby")
#calling multilevel
l_det=librarian_det()
l_det.display()
#calling multiple inheritance
bk=books()
bk.display()
#calling hirarichial
usr=user()
usr.display()