public void AdapterTest() { //adapter pattern allows the interface of an existing class //to be used as another interface. //it is often used to make existing classes work with others without //modifying their source code Switch lightSwitch = new Switch(new Ligh()); lightSwitch.ApplySwitchsignal(true); lightSwitch.ApplySwitchsignal(false); Switch fanSwitch = new Switch(new Fan()); fanSwitch.ApplySwitchsignal(true); fanSwitch.ApplySwitchsignal(false); Switch huaweiLightSwitch = new Switch(new HuaweiLightDelegateAdapter()); huaweiLightSwitch.ApplySwitchsignal(true); huaweiLightSwitch.ApplySwitchsignal(false); Switch huaweiLightSwitch2 = new Switch(new HuaweiLightInheritAdapter()); huaweiLightSwitch2.ApplySwitchsignal(true); huaweiLightSwitch2.ApplySwitchsignal(false); }