-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram52.py
More file actions
64 lines (49 loc) · 1.49 KB
/
program52.py
File metadata and controls
64 lines (49 loc) · 1.49 KB
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
59
60
61
62
63
64
#Inheritance-----------
#Parent, Super ,Base Class--
#Child, Sub, Drived Class----
class phone:
def call(self):
print("You can call")
def massage(self):
print("You can message")
class samsang(phone):
def photo(self):
print("Take photos")
p = samsang()
p.call()
p.massage()
p.photo()
print(issubclass(samsang,phone))
#Inheritance-----------
class Teacher:
def __init__(self,name,passed,gpa):
self.name = name
self.passed = passed
self.gpa = gpa
def display(self):
print(f"Name : {self.name},SSC Passed : {self.passed},Gpa : {self.gpa}")
class Student(Teacher):
def __init__(self,name,passed,gpa,class1,roll):
#samsang.__init__()
self.name = name
self.passed = passed
self.gpa = gpa
self.class1 = class1
self.roll = roll
def display(self):
print(f"Name : {self.name},SSC Passed : {self.passed},Gpa : {self.gpa},Class : {self.class1},Roll : {self.roll}")
print("Teacher Details : ")
Arif = Teacher("Ariful Islam",2015,4.50)
Arif.display()
Tamim = Teacher("Tamim Iqbal",2016,4.00)
Tamim.display()
Nazim = Teacher("Nazim Uddin",2017,4.20)
Nazim.display()
Nasim = Teacher("Nasim Khan",2015,4.30)
Nasim.display()
print(issubclass(Student,Teacher))
print("Student details : ")
Nazim = Student("Nazim Uddin",2017,4.20,"One",101)
Nazim.display()
Nasim = Student("Nasim Khan",2015,4.30,"Two",102)
Nasim.display()