-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathE9_15_AbsClass.java
More file actions
92 lines (76 loc) · 1.44 KB
/
Copy pathE9_15_AbsClass.java
File metadata and controls
92 lines (76 loc) · 1.44 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package unit9;
/**
* 创建一个抽象类,并将其继承到一个导出类中。
*
* @author Administrator
*
*/
abstract class AbsTest{
abstract void aFun();
}
class BaseP2 extends AbsTest implements ComInterface{
@Override
public void fFun() {
// TODO Auto-generated method stub
System.out.println("BaseP f");
}
@Override
public void fFun2() {
// TODO Auto-generated method stub
System.out.println("BaseP f2");
}
@Override
public void sFun() {
// TODO Auto-generated method stub
System.out.println("BaseP s");
}
@Override
public void sFun2() {
// TODO Auto-generated method stub
System.out.println("BaseP s2");
}
@Override
public void tFun() {
// TODO Auto-generated method stub
System.out.println("BaseP t");
}
@Override
public void tFun2() {
// TODO Auto-generated method stub
System.out.println("BaseP t2");
}
@Override
public void cFun() {
// TODO Auto-generated method stub
System.out.println("BaseP c");
}
@Override
void aFun() {
// TODO Auto-generated method stub
System.out.println("BaseP abs a");
}
}
public class E9_15_AbsClass {
static void t1(FirInterface f) {
f.fFun();
f.fFun2();
}
static void t2(SecInterface s) {
s.sFun();
s.sFun2();
}
static void t3(ThiInterface t) {
t.tFun();
t.tFun2();
}
static void t4(ComInterface c) {
c.cFun();
}
public static void main(String[] args) {
BaseP2 bp = new BaseP2();
t1(bp);
t2(bp);
t3(bp);
t4(bp);
}
}