-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathISendPresents.java
More file actions
61 lines (45 loc) · 938 Bytes
/
ISendPresents.java
File metadata and controls
61 lines (45 loc) · 938 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package u007;
/**
* Created by HuGuodong on 11/19/19.
*/
public interface ISendPresents {
void sendFlower();
void sendDoll();
void sendChocolate();
}
class Pursuit implements ISendPresents {
private String girlName;
public Pursuit(String name) {
this.girlName = name;
}
@Override
public void sendFlower() {
System.out.printf("%s, here is your flower.\n", girlName);
}
@Override
public void sendDoll() {
System.out.printf("%s, here is your doll.\n", girlName);
}
@Override
public void sendChocolate() {
System.out.printf("%s, here is your chocolate.\n", girlName);
}
}
class Proxy implements ISendPresents {
private Pursuit p;
public Proxy(Pursuit p) {
this.p = p;
}
@Override
public void sendFlower() {
p.sendFlower();
}
@Override
public void sendDoll() {
p.sendDoll();
}
@Override
public void sendChocolate() {
p.sendChocolate();
}
}