-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOOP_inheritance.py
More file actions
38 lines (26 loc) · 809 Bytes
/
OOP_inheritance.py
File metadata and controls
38 lines (26 loc) · 809 Bytes
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
class Student:
def __init__(self ,name, age, DOB):
self.name = name
self.age = age
self.DOB = DOB
def get_stud_data(self, name, age, DOB):
self.name = name
self.age = age
self.DOB = DOB
def display_stud_data(self):
print("Name : ",self.name)
print("Age : ",self.age)
print("Date of Birth {}".format(self.DOB))
class ScienceStudent(Student):
def disp_sci(self):
print("Science Students Batch")
class ComputerStudent(Student):
def disp_com(self):
print("Computer Students Batch")
sci = ScienceStudent("", "", "")
sci.disp_sci()
name = input("Enter the name :")
age = input("Enter the age :")
dob = input("Enter the date of birth :")
sci.get_stud_data(name, age, dob)
sci.display_stud_data()