2019-01-25 02:52:40 +08:00
|
|
|
from example12 import EmployeeFactory
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
"""主函数"""
|
|
|
|
emps = [
|
|
|
|
EmployeeFactory.create('M', '曹操'),
|
|
|
|
EmployeeFactory.create('P', '荀彧', 120),
|
|
|
|
EmployeeFactory.create('P', '郭嘉', 85),
|
|
|
|
EmployeeFactory.create('S', '典韦', 123000),
|
|
|
|
]
|
|
|
|
for emp in emps:
|
|
|
|
print('%s: %.2f元' % (emp.name, emp.get_salary()))
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|