-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathAuthor.java
More file actions
35 lines (30 loc) · 734 Bytes
/
Author.java
File metadata and controls
35 lines (30 loc) · 734 Bytes
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
package examplesUsingMainClass;
import tester.ISame;
/**
* A class to represent an author with name and age.
* An example of a class with object containment.
*/
public class Author implements ISame<Author> {
/** Author's name */
public String name;
/** Author's age */
public int age;
/**
* Constructor
*
* @param name the author's name
* @param age the author's age
*/
public Author(String name, int age) {
this.name=name;
this.age=age;
}
/**
* Implement the <CODE>{@link ISame ISame}</CODE> interface differently
* from the one provided by the test harness -- to test the correct dispatch
* of the test harness
*/
public boolean same(Author that) {
return this.name.equals(that.name);
}
}