打字猴:1.700456561e+09
1700456561 代码清单6-8 计算机书籍接口
1700456562
1700456563 public interface IComputerBook extends IBook{
1700456564
1700456565 //计算机书籍是有一个范围
1700456566
1700456567 public String getScope();
1700456568
1700456569 }
1700456570
1700456571 很简单,计算机书籍增加了一个方法,就是获得该书籍的范围,同时继承IBook接口,毕竟计算机书籍也是书籍,其实现如代码清单6-9所示。
1700456572
1700456573 代码清单6-9 计算机书籍类
1700456574
1700456575 public class ComputerBook implements IComputerBook{
1700456576
1700456577 private String name;
1700456578
1700456579 private String scope;
1700456580
1700456581 private String author;
1700456582
1700456583 private int price;
1700456584
1700456585 public ComputerBook(String_name,int_price,String_author,String_scope){
1700456586
1700456587 this.name=_name;
1700456588
1700456589 this.price=_price;
1700456590
1700456591 this.author=_author;
1700456592
1700456593 this.scope=_scope;
1700456594
1700456595 }
1700456596
1700456597 public String getScope(){
1700456598
1700456599 return this.scope;
1700456600
1700456601 }
1700456602
1700456603 public String getAuthor(){
1700456604
1700456605 return this.author;
1700456606
1700456607 }
1700456608
1700456609 public String getName(){
1700456610
[ 上一页 ]  [ :1.700456561e+09 ]  [ 下一页 ]