父类当中我 private 两个属性, 然后生成了 set 和get方法(我用的 public修饰). 然后我又创建了一个子类,父类中的get和set方法为什么不能被子类继承呢?
父类代码:
package com.sunhailong;
public class RentBookSystem {
private String bookName;
private int bookNum;
public int getBookNum() {
return bookNum;
}
public void setBookNum(int bookNum) {
this.bookNum = bookNum;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public RentBookSystem(int bookNum,String bookName){
this.bookNum=bookNum;
this.bookName=bookName;
}
public RentBookSystem(){
}
}
丶低调丶
相关分类