repo.or.cz
/
mcs.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2010-06-21 Atsushi Enomoto <atsushi@ximian.com>
[mcs.git]
/
tests
/
test-20.cs
blob
006bd45075e274947002ddef33df6462e86e4eac
1
//
2
// This generates a warning
3
//
4
using
System
;
5
6
class
A
{
7
public int
a
;
8
9
public void
X
()
10
{
11
a
=
1
;
12
}
13
}
14
15
class
B
:
A
{
16
void
X
()
17
{
18
a
=
2
;
19
}
20
21
public void
TestB
()
22
{
23
X
();
24
}
25
}
26
27
class
Ax
{
28
public int
a
;
29
30
public virtual void
A
()
31
{
32
a
=
1
;
33
}
34
35
public virtual void
B
()
36
{
37
a
=
3
;
38
}
39
}
40
41
class
Bx
:
Ax
{
42
public override void
A
()
43
{
44
a
=
2
;
45
}
46
public new void
B
()
47
{
48
a
=
4
;
49
}
50
}
51
class
Test
{
52
static int
Main
()
53
{
54
B b
=
new
B
();
55
56
b
.
TestB
();
57
if
(
b
.
a
!=
2
)
58
return
1
;
59
60
Bx bx
=
new
Bx
();
61
bx
.
A
();
62
if
(
b
.
a
!=
2
)
63
return
2
;
64
bx
.
B
();
65
Console
.
WriteLine
(
"a="
+
bx
.
a
);
66
if
(
bx
.
a
!=
4
)
67
return
3
;
68
return
0
;
69
}
70
}