设计模式-适配器模式
猫学狗叫
public interface Cat{
public void meow();
}
public class Dog{
public void Bark(){
System.out.println("Bark...........");
}
}
public class Adapter extends Cat implements Dog{
public void meow(){
super.Bark();
}
}
public class Test{
public static void main(String[] args){
Cat cat = new Adapter();
cat.meow();
}
}