projects
/
mono.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
2002-05-05 Miguel de Icaza <miguel@ximian.com>
[mono.git]
/
mcs
/
tests
/
test-28.cs
1
abstract class A {
2
protected abstract int this [int a] { get; }
3
4
public int EmulateIndexer (int a)
5
{
6
return this [a];
7
}
8
}
9
10
class B : A {
11
protected override int this [int a] { get { return a;} }
12
13
public int M ()
14
{
15
return this [0];
16
}
17
18
}
19
class X {
20
int v1, v2;
21
22
int this [int a] {
23
get {
24
if (a == 0)
25
return v1;
26
else
27
return v2;
28
}
29
30
set {
31
if (a == 0)
32
v1 = value;
33
else
34
v2 = value;
35
}
36
}
37
38
static int Main ()
39
{
40
X x = new X ();
41
42
x [0] = 1;
43
if (x.v1 != 1)
44
return 1;
45
46
if (x [0] != 1)
47
return 2;
48
49
B bb = new B ();
50
51
if (bb.EmulateIndexer (10) != 10)
52
return 3;
53
54
return new B ().M ();
55
}
56
}