public class playeradapter implement player{
public expensivemp4 expensivemp4;
public playeradapter (){
this.expensivemp4 = new expensivemp4();
}
public void action(){
if(expensivemp4 != null){
expensivemp4 .play();
}
}
}
感觉这样好像不太灵活,expensivemp4像死的一样,毫无灵魂,好吧,我们改改。
public class playeradapter implement player{
public expensivemp4 expensivemp4;
public playeradapter (expensivemp4 expensivemp4){
this.expensivemp4 = expensivemp4;
}
public void action(){
if(expensivemp4 != null){
expensivemp4 .play();
}
}
}
public class playeradapter implement player{
public mp4 mp4;
public playeradapter (mp4 mp4){
this.mp4 = mp4;
}
public void action(){
if(mp4!= null){
mp4.play();
}
}
}