-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPhotoPost.java
More file actions
49 lines (45 loc) · 1.23 KB
/
PhotoPost.java
File metadata and controls
49 lines (45 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.ArrayList;
/**
* This class stores information about a post in a social network news feed.
* The main part of the post consists of a photo and a caption.
* Other data, such as author and time, are also stored.
*
* @author Michael Kölling and David J. Barnes
* @version 0.2
*/
public class PhotoPost extends Post
{
private String filename; // the name of the image file
private String caption; // a one line image caption
/**
* Constructor for objects of class PhotoPost.
*
* @param author The username of the author of this post.
* @param filename The filename of the image in this post.
* @param caption A caption for the image.
*/
public PhotoPost(String author, String filename, String caption)
{
super(author);
this.filename = filename;
this.caption = caption;
}
/**
* Return the file name of the image in this post.
*
* @return The post's image file name.
*/
public String getImageFile()
{
return filename;
}
/**
* Return the caption of the image of this post.
*
* @return The image's caption.
*/
public String getCaption()
{
return caption;
}
}