第十八讲、中介者模式

1.定义

Mediator模式也叫中介者模式,是由GOF提出的23种软件设计模式中的一种。Mediator模式是行为模式之一,在Mediator模式中,类之间的交互行为被统一放在Mediator的对象中,对象通过Mediator对象同其他对象交互,Mediator对象起着控制器的作用。

2.中介者模式的结构

      

3.中介者模式的角色和职责

mediator--中介者类的抽象父类

concreteMediator--具体的中介者类

colleague--关联类的抽象父类

concreteColleague--具体的关联类

4.

猜你喜欢

转载自www.cnblogs.com/zheaven/p/10179298.html