You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
930 B

package com.yyt.moviecrawler.model;
public abstract class Movie {
private String title;
private double score;
private String type;
private String author; // 加这个字段
// 1. 三参数构造器(原来的)
public Movie(String title, double score, String type) {
this.title = title;
this.score = score;
this.type = type;
}
// 2. 四参数构造器(新增,给子类用)
public Movie(String title, double score, String type, String author) {
this.title = title;
this.score = score;
this.type = type;
this.author = author;
}
// Getter 方法(必须加,子类 printInfo 里要用到)
public String getTitle() { return title; }
public double getScore() { return score; }
public String getType() { return type; }
public String getAuthor() { return author; }
public abstract void printInfo();
}