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
}
1700476899
1700476900
public String getEngine(){
1700476901
1700476902
return engine;
1700476903
1700476904
}
1700476905
1700476906
public void setEngine(String engine){
1700476907
[
上一页 ]
[ :1.700476858e+09 ]
[
下一页 ]