1700463846
1700463847
}
1700463848
1700463849
女性接口仅两个方法,一个是取得当前的个人状况getType,通过返回值决定是结婚了还是没结婚、丈夫是否在世等,另外一个方法getRequest是要请示的内容,要出去逛街还是吃饭,其实现类如代码清单16-2所示。
1700463850
1700463851
代码清单16-2 古代妇女
1700463852
1700463853
public class Women implements IWomen{
1700463854
1700463855
/*
1700463856
1700463857
*通过一个int类型的参数来描述妇女的个人状况
1700463858
1700463859
*1—未出嫁
1700463860
1700463861
*2—出嫁
1700463862
1700463863
*3—夫死
1700463864
1700463865
*/
1700463866
1700463867
private int type=0;
1700463868
1700463869
//妇女的请示
1700463870
1700463871
private String request=””;
1700463872
1700463873
//构造函数传递过来请求
1700463874
1700463875
public Women(int_type,String_request){
1700463876
1700463877
this.type=_type;
1700463878
1700463879
this.request=_request;
1700463880
1700463881
}
1700463882
1700463883
//获得自己的状况
1700463884
1700463885
public int getType(){
1700463886
1700463887
return this.type;
1700463888
1700463889
}
1700463890
1700463891
//获得妇女的请求
1700463892
1700463893
public String getRequest(){
1700463894
1700463895
return this.request;
[
上一页 ]
[ :1.700463846e+09 ]
[
下一页 ]