blob: 6deae7aa762139b26d5adc9407ac6c6b5a651506 (
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
|
using System;
namespace InternalAccess
{
public abstract class Base
{
internal Base () { }
internal string Prop { get { return "A"; } }
}
public class DerivedInternalExample : Base
{
public DerivedInternalExample () { }
internal new string Prop { get { return "D"; } }
}
public class DerivedProtectedExample : Base
{
public DerivedProtectedExample () { }
protected new string Prop { get { return "E"; } }
}
class MainClass
{
public static int Main ()
{
DerivedInternalExample die = new DerivedInternalExample ();
if (die.Prop != "D")
return 1;
DerivedProtectedExample dpe = new DerivedProtectedExample ();
if (dpe.Prop != "A")
return 2;
return 0;
}
}
}
|