1700480665
1700480666
代码清单33-43 替身演员
1700480667
1700480668
public class Standin implements IStar{
1700480669
1700480670
private IActor actor;
1700480671
1700480672
//替身是谁
1700480673
1700480674
public Standin(IActor_actor){
1700480675
1700480676
this.actor=_actor;
1700480677
1700480678
}
1700480679
1700480680
public void act(String context){
1700480681
1700480682
actor.playact(context);
1700480683
1700480684
}
1700480685
1700480686
}
1700480687
1700480688
这是一个通用的替身,哪个普通演员能担任哪个明星的替身是由导演决定的,导演想让谁当就让谁当,我们来看导演,如代码清单33-44所示。
1700480689
1700480690
代码清单33-44 导演类
1700480691
1700480692
public class direcotr{
1700480693
1700480694
public static void main(String[]args){
1700480695
1700480696
System.out.println(”=======演戏过程模拟==========”);
1700480697
1700480698
//定义一个大明星
1700480699
1700480700
IStar star=new FilmStar();
1700480701
1700480702
star.act(“前十五分钟,明星本人演戏”);
1700480703
1700480704
//导演把一个普通演员当做明星演员来用
1700480705
1700480706
IActor actor=new UnknownActor();
1700480707
1700480708
IStar standin=new Standin(actor);
1700480709
1700480710
standin.act(“中间五分钟,替身在演戏”);
1700480711
1700480712
star.act(“后十五分钟,明星本人演戏”);
1700480713
1700480714
}
[
上一页 ]
[ :1.700480665e+09 ]
[
下一页 ]