打字猴:1.700476849e+09
1700476849
1700476850 public void receiveBlueprint(Blueprint_bp){
1700476851
1700476852 this.bp=_bp;
1700476853
1700476854 }
1700476855
1700476856 //查看蓝图,只有真正的建造者才可以查看蓝图
1700476857
1700476858 protected Blueprint getBlueprint(){
1700476859
1700476860 return bp;
1700476861
1700476862 }
1700476863
1700476864 //建造车轮
1700476865
1700476866 protected abstract String buildWheel();
1700476867
1700476868 //建造引擎
1700476869
1700476870 protected abstract String buildEngine();
1700476871
1700476872 }
1700476873
1700476874 看到Blueprint类了,它中文的意思是“蓝图”,你要建造一辆车必须有一个设计样稿或者蓝图吧,否则怎么生产?怎么装配?该类就是一个可参考的生产样本,如代码清单30-26所示。
1700476875
1700476876 代码清单30-26 生产蓝图
1700476877
1700476878 public class Blueprint{
1700476879
1700476880 //车轮的要求
1700476881
1700476882 private String wheel;
1700476883
1700476884 //引擎的要求
1700476885
1700476886 private String engine;
1700476887
1700476888 public String getWheel(){
1700476889
1700476890 return wheel;
1700476891
1700476892 }
1700476893
1700476894 public void setWheel(String wheel){
1700476895
1700476896 this.wheel=wheel;
1700476897
1700476898 }
[ 上一页 ]  [ :1.700476849e+09 ]  [ 下一页 ]