代码改变世界

设计模式---适配器模式

2011-08-18 17:29  Rollen Holt  阅读(1363)  评论(3编辑  收藏  举报
/**
 * @author Rollen-Holt 设计模式之 適配器模式
 */

interface window{
	void open();
	void close();
	void activated();
	void iconified();
}

abstract class WindowAdapter{
	public void open(){

	}
	public void close(){

	}
	public void activated(){
		
	}
	public void iconified(){
		
	}
}

class AdapterDemo extends WindowAdapter{
	public void open(){
		System.out.println("打开窗口");
	}
	public void close(){
		System.out.println("关闭窗口");
	}
}

class hello{
	public static void main(String[] a){
		AdapterDemo a1=new AdapterDemo();
		a1.open();
		a1.close();
	}
}