Java程序设计开发实战继承与多态.pptxVIP

  • 4
  • 0
  • 约1.68万字
  • 约 46页
  • 2023-09-14 发布于福建
  • 举报
Java程序设计开发实战第7章:继承与多态 范例:继承问题引出编写图书类:编写数学图书类:class Book { // 图书 private String title ; private String author ; private double price ; public void setTitle(String title) { this.title = title ; } public void setAuthor(String author) { this.author = author ; } public void setPrice(double price) { this.price = price ; } public String getTitle() { return this.title ; } public String getAuthor() { return this.author ; } public double getPrice() { return this.price ; }}class MathBook { // 数学图书 private String title ; private String author ; private double price ; private String type ; //

文档评论(0)

1亿VIP精品文档

相关文档