1b: add AuthoredItem as superclass for Article and Image

This commit is contained in:
Daniel Langbein 2024-11-24 19:00:50 +01:00
parent db12a40520
commit 67e5565b54
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
3 changed files with 9 additions and 14 deletions

View File

@ -23,11 +23,4 @@ public class Article extends AuthoredItem {
return "Article: " + getTitle() + ", Author: " return "Article: " + getTitle() + ", Author: "
+ getAuthor(); + getAuthor();
} }
public String getDetails(){
return "###" + getTitle() + "###"
+ "\n"
+ getContent()
+ "\n\n";
}
} }

View File

@ -5,6 +5,15 @@ public abstract class AuthoredItem extends Item{
protected String author; protected String author;
protected String content; protected String content;
public String getDetails(){
return "###" + getTitle() + "###"
+ "\n"
+ getContent()
+ "\n\n";
}
//=================================
/** /**
* Get the title of the AuthoredItem. * Get the title of the AuthoredItem.
* *

View File

@ -32,13 +32,6 @@ public class Image extends AuthoredItem {
+ ", Author: " + getAuthor(); + ", Author: " + getAuthor();
} }
public String getDetails(){
return "###" + getTitle() + "###"
+ "\n"
+ getContent()
+ "\n\n";
}
//================================= //=================================
/** /**