blob: 4fe9b8d5e00ff1392d61b5bde161d44e4f5d8f22 (
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
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
|
using System;
struct A
{
public readonly int i;
public A (int i)
{
this.i = i;
}
}
class X
{
int i;
public int Foo {
get {
return 2 * i;
}
set {
i = value;
}
}
public int this [int a] {
get {
return (int) Foo;
}
set {
Foo = a;
}
}
public string this [string a] {
set {
Console.WriteLine (a);
}
}
public string Bar {
set {
Console.WriteLine (value);
}
}
public A A {
get {
return new A (5);
}
set {
Console.WriteLine (value);
}
}
public X (int i)
{
this.i = i;
}
public static int Main ()
{
X x = new X (9);
int a = x.Foo = 16;
int b = x [8] = 32;
x ["Test"] = "Hello";
x.Bar = "World";
x.A = new A (9);
// Compilation-only test.
return 0;
}
}
|