定义一个抽象类,读物Book,在派生出小说类tale,杂志类magazing,期刊类journal,课本textbook。
发布网友
发布时间:2022-07-12 13:38
我来回答
共1个回答
热心网友
时间:2023-10-18 09:45
//抽象类book,方法
abstract class Book {
//共同属性
private int page;
private double price;
public abstract String getinfo(Book book);
}
//小说类
abstract class Tale extends Book{
}
//杂志类
abstract class Magazing extends Book{
private int publishingcycle;
}
//期刊类
abstract class Journal extends Book{
private int publishingcycle;
}
//课本类
abstract class Textbook extends Book{
private String reader;
}