Java 设计模式 之 适配器
http://www.verejava.com/?id=16998997872057
package com.adapter.theory;
public class TestBattery
{
public static void main(String[] args)
{
Plug plug=new AdapterPlug();
System.out.println(plug.recharge());
}
}
package com.adapter.theory;
public interface Plug
{
public int recharge();
}
package com.adapter.theory;
public class BigPlug
{
public int recharge()
{
return 100;
}
}
package com.adapter.theory;
public interface Plug
{
public int recharge();
}