适配器模式:将一个类的接口转换成客户希望的另外一个接口。适配器(Adapter)模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。也叫包装器(Wrappter)。
有两类适配器模式:
·对象适配器模式 - 在这种适配器模式中,适配器容纳一个它包裹的类的实例。在这种情况下,适配器调用被包裹对象的物理实体。
·类适配器模式 - 这种适配器模式下,适配器继承自已实现的类(一般多重继承)。