blob: 6fe8da995e89c2f8c3a45588934ca63c31718c2a (
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
|
//
// Tests the right settings for overrides
//
class X {
public virtual int A {
get {
return 1;
}
}
public virtual int B ()
{
return 1;
}
}
class Y : X {
public override int A {
get {
return base.A + 2;
}
}
public override int B ()
{
return base.B () + 1;
}
}
class Z {
static int Main ()
{
Y y = new Y ();
X x = new X ();
if (y.B () != 2)
return 1;
if (y.A != 3)
return 2;
if (x.A != 1)
return 3;
if (x.B () != 1)
return 4;
return 0;
}
}
|