projects
/
IRC.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
change
[IRC.git]
/
Robust
/
src
/
Tests
/
virtualcalltest.java
1
class A {
2
A() {
3
;
4
}
5
6
void foo(int x) {
7
System.printInt(x);
8
System.printString("\n");
9
}
10
}
11
12
13
class B extends A {
14
B() {
15
;
16
}
17
18
void foo(int x) {
19
}
20
}
21
22
23
class C extends A {
24
C() {
25
;
26
}
27
28
void foo(int x) {
29
}
30
}
31
32
public class virtualcalltest {
33
public static void main(String str[]) {
34
35
A a=null;
36
B b=new B();
37
C c=new C();
38
for(int i=0;i<1000000;i++) {
39
if (i%2==0)
40
a=b;
41
else
42
a=c;
43
44
a.foo(20);
45
}
46
}
47
}