[mcs] Pending implementation of accessors cannot hide base implementation with differ...
[mono.git] / mcs / tests / test-173.cs
1 using System;
2
3 class Base
4 {
5         int value;
6
7         public int Value {
8                 get { return value; }
9         }
10
11         protected Base (int value)
12         {
13                 this.value = value;
14         }
15 }
16
17 class A : Base
18 {
19         public A (int value)
20                 : base (1)
21         {
22                 Console.WriteLine ("Int");
23         }
24
25         public A (uint value)
26                 : base (2)
27         {
28                 Console.WriteLine ("UInt");
29         }
30 }
31
32 class B : Base
33 {
34         public B (long value)
35                 : base (3)
36         {
37                 Console.WriteLine ("Long");
38         }
39
40         public B (ulong value)
41                 : base (4)
42         {
43                 Console.WriteLine ("ULong");
44         }
45 }
46
47 class C : Base
48 {
49         public C (short value)
50                 : base (5)
51         {
52                 Console.WriteLine ("Short");
53         }
54
55         public C (ushort value)
56                 : base (6)
57         {
58                 Console.WriteLine ("UShort");
59         }
60 }
61
62 class D : Base
63 {
64         public D (sbyte value)
65                 : base (7)
66         {
67                 Console.WriteLine ("SByte");
68         }
69
70         public D (byte value)
71                 : base (8)
72         {
73                 Console.WriteLine ("Byte");
74         }
75 }
76
77 class E : Base
78 {
79         public E (long value)
80                 : base (9)
81         {
82                 Console.WriteLine ("Long");
83         }
84
85         public E (E e)
86                 : base (10)
87         {
88                 Console.WriteLine ("E");
89         }
90
91         public static implicit operator E (long value) 
92         {
93                 return (new E (value));
94         }
95 }
96
97 class F : Base
98 {
99         public F (int value)
100                 : base (11)
101         {
102                 Console.WriteLine ("Int");
103         }
104
105         public F (F f)
106                 : base (12)
107         {
108                 Console.WriteLine ("F");
109         }
110
111         public static implicit operator F (int value) 
112         {
113                 return (new F (value));
114         }
115 }
116
117 class X
118 {
119         static int Test ()
120         {
121                 {
122                         A a = new A (4);
123                         if (a.Value != 1)
124                                 return 1;
125
126                         B b = new B (4);
127                         if (b.Value != 3)
128                                 return 2;
129
130                         C c = new C (4);
131                         if (c.Value != 5)
132                                 return 3;
133
134                         D d = new D (4);
135                         if (d.Value != 7)
136                                 return 4;
137                 }
138
139                 {
140                         A a = new A (4u);
141                         if (a.Value != 2)
142                                 return 5;
143
144                         B b = new B (4u);
145                         if (b.Value != 3)
146                                 return 6;
147
148                         C c = new C (4);
149                         if (c.Value != 5)
150                                 return 7;
151
152                         D d = new D (4);
153                         if (d.Value != 7)
154                                 return 8;
155                 }
156
157                 {
158                         E e = new E (4);
159                         if (e.Value != 9)
160                                 return 9;
161
162                         F f = new F (4);
163                         if (f.Value != 11)
164                                 return 10;
165                 }
166
167                 return 0;
168         }
169
170         public static int Main ()
171         {
172                 int result = Test ();
173                 Console.WriteLine ("RESULT: {0}", result);
174                 return result;
175         }
176 }