-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinheritance.py
More file actions
35 lines (28 loc) · 892 Bytes
/
inheritance.py
File metadata and controls
35 lines (28 loc) · 892 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
class person(object):
person = 0
def __init__(self):
self.name = input("Enter your name: ")
self.idnumber = input("Enter your idnumber: ")
# def display(self):
# print(self.name)
# print(self.idnumber)
def details(self):
print("My name is {}".format(self.name))
print("My IdNumber is: {}".format(self.idnumber))
class Employee(person):
Employee = 0
# def __init__(self, name, idnumber, salary, post):
def __init__(self):
self.salary = input("Enter your salary: ")
self.post = input("Enter your post: ")
person.__init__(self)
def details(self):
print("My name is: {}".format(self.name))
print("IdNumber: {}".format(self.idnumber))
print("post: {}".format(self.post))
a1 = Employee()
a1.details()
a2 = Employee()
a2.details()
a3 = Employee()
a3.details()