blob: 7e2df6f4fc364096f7509e99a9043c65049f5e7a (
plain)
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
|
using System;
public class A
{
protected int value = 9;
public virtual int this [int i]
{
get { throw new NotImplementedException (); }
set { this.value = i; }
}
}
public class B : A
{
public override int this [int i]
{
get { return value; }
}
}
public class C : B
{
public override int this [int i]
{
get { return base [i]; }
set { base [i] = value; }
}
public static int Main ()
{
var c = new C ();
var r = c [100]++;
Console.WriteLine (r);
if (r != 9)
return 1;
return 0;
}
}
|