-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemployee_derived_class.py
More file actions
48 lines (38 loc) · 1.19 KB
/
Copy pathemployee_derived_class.py
File metadata and controls
48 lines (38 loc) · 1.19 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
import sys
import os
from person_base_class import Person
class Employee(Person):
'''
employee derived class
'''
def __init__(self, first, last, id=None):
super().__init__(first, last)
self.id_number = id
@property
def property_id(self):
self.id_number
@property_id.setter
def property_id(self, new_id):
self.id_number = new_id
def employee_name(self):
'''
get employee name only
:return employee name information
'''
try:
employee_info = self.FirstLastName()
except:
exception_message = sys.exc_info()[0]
print("An error occurred. {}".format(exception_message))
return employee_info
def employee_name_id(self):
'''
get employee name and id with overridden the FirstLastName()
:return employee name and id information
'''
try:
employee_info = self.FirstLastName() + " | " + self.id_number
except:
exception_message = sys.exc_info()[0]
print("An error occurred. {}".format(exception_message))
return employee_info