Move Enum and CorElementType to shared (dotnet/coreclr#23177)
[mono-project.git] / mcs / tests / test-398.cs
blobd8cc6f02d20be111260e1c4be6b4ca0be0b2f20a
1 //
2 // Test for access modifiers
3 //
5 using System;
7 public class Tester {
9 public static void Main ()
11 A a = new A (8);
12 B b = new B (9);
14 b.SetCount (10);
15 Console.WriteLine ("b.Count should be 9: {0}", b.Count);
16 Console.WriteLine ("b [{0}] should return {0}: {1}", 10, b [10]);
18 Console.WriteLine ("a.Message : {0}", a.Message);
19 b.Message = "";
20 Console.WriteLine ("b.Messasge : {0}", b.Message);
25 public class A {
27 protected int count;
29 public A (int count)
31 this.count = count;
34 public virtual int Count {
35 get {
36 return count;
38 protected set {
39 count = value;
43 public virtual int this [int index] {
44 get {
45 return index;
49 public virtual string Message {
50 get {
51 return "Hello Mono";
57 public class B : A {
59 public B (int count) : base (count)
63 public override int Count {
64 protected set {
68 public void SetCount (int value)
70 Count = value;
73 public override int this [int index] {
74 get {
75 return base [index];
79 public new string Message {
80 get {
81 return "Hello Mono (2)";
83 internal set {