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.
28 lines
910 B
28 lines
910 B
public abstract class Movie {
|
|
private String title;
|
|
private int year;
|
|
private double rating;
|
|
private String genre;
|
|
|
|
public Movie() {}
|
|
|
|
public Movie(String title, int year, double rating, String genre) {
|
|
this.title = title;
|
|
this.year = year;
|
|
this.rating = rating;
|
|
this.genre = genre;
|
|
}
|
|
|
|
// 抽象方法:由不同类型的电影自己实现播放逻辑
|
|
public abstract void play();
|
|
|
|
// getter & setter
|
|
public String getTitle() { return title; }
|
|
public void setTitle(String title) { this.title = title; }
|
|
public int getYear() { return year; }
|
|
public void setYear(int year) { this.year = year; }
|
|
public double getRating() { return rating; }
|
|
public void setRating(double rating) { this.rating = rating; }
|
|
public String getGenre() { return genre; }
|
|
public void setGenre(String genre) { this.genre = genre; }
|
|
}
|
|
|