rom abc import ABCMeta, abstractmethod
class Handler(metaclass=ABCMeta):
@abstractmethod
def handle_leave(self,day):
pass class GeneralManager(Handler):
def handle_leave(self,day):
if day <= 10:
print(f'总经理准假{day}天')
else:
print('不予批准!') class DepartmentManager(Handler):
def __init__(self):
self.next = GeneralManager() def handle_leave(self, day):
if day <= 5:
print(f'部门经理准假{day}天')
else:
print('权限不足,请求上级审批!!')
self.next.handle_leave(day) class ProjectDirector(Handler):
def __init__(self):
self.next = DepartmentManager() def handle_leave(self, day):
if day <= 3:
print(f'项目主管准假{day}天')
else:
print("权限不足,请求上级审批!!")
self.next.handle_leave(day)

测试:

最新文章

  1. windows多线程编程星球(一)
  2. as3正则表达式
  3. 利用crontab系统每天定时备份MySQL数据库
  4. Myeclispe 安装 SVN :
  5. 安装和使用Linux花生壳(公网版)
  6. 多线程编程4 - NSOperationQueue
  7. JS-改变页面的颜色(二)
  8. base.js
  9. 设计模式C#实现(四)——迭代器模式
  10. Codeforces Round #339 Div.2 B - Gena&#39;s Code
  11. 《搭建更新DNS集群服务》RHEL6
  12. git bash中带空格的文件夹以及文件的处理
  13. Oracle sequence排序的使用
  14. linux int to string 方法
  15. Robot Framework与Web界面自动化测试学习笔记:定位到新窗口
  16. C++实现动态顺序表
  17. Andorid自动读取短信验证码
  18. hdu4614 线段树+二分 插花
  19. 《程序设计实践》【PDF】下载
  20. ZOJ3774 Power of Fibonacci 斐波那契、二项式定理

热门文章

  1. matplotlib animation
  2. 【C/C++】习题3-7 DNA/算法竞赛入门经典/数组与字符串
  3. pytest_BDD + allure 自动化测试框架
  4. Airtest结合tidevice实现IOS自动化测试
  5. pipeline 结构设计
  6. 两大js移动端调试神器 / 调试工具分享 !
  7. Table.SplitColumn拆分…Split…(Power Query 之 M 语言)
  8. CF1025B Weakened Common Divisor 题解
  9. cmake之错误【Modules/ExternalProject.cmake:3206 (_ep_add_download_command)....】
  10. 【九度OJ】题目1177:查找 解题报告