# -*- coding: utf-8 -*-
"""
Created on Mon Feb 26 11:45:46 2018
@author: mz
"""
class Handler(object):
def __init__(self):
self.handler = None
def Handle(self):
pass
def NextHandler(self, rhs):
self.handler = rhs
class Boss(Handler):
def Handle(self):
print("Boss handle")
if self.handler is not None:
self.handler.Handle()
class Derector(Handler):
def Handle(self):
print("Derector handle ->")
if self.handler is not None:
self.handler.Handle()
class Manager(Handler):
def Handle(self):
print("Manager handle ->")
if self.han
Python 责任链模式实现
最新推荐文章于 2024-07-22 13:37:08 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)