2010-06-21 Atsushi Enomoto <atsushi@ximian.com>
[mcs.git] / tests / test-51.cs
blob3a6257747b6f3ee758d1ec77aca3d3c3f54eb3d9
1 //
2 // This test is used to test the `base' implementation
3 //
4 using System;
6 class Base {
7 public int b_int_field;
8 public string b_string_field;
10 public const int b_const_three = 3;
12 public int b_int_property {
13 get {
14 return b_int_field;
17 set {
18 b_int_field = value;
22 public string b_get_id ()
24 return "Base";
27 public Base ()
29 b_int_field = 1;
30 b_string_field = "base";
34 class Derived : Base {
35 new int b_int_field;
36 new string b_string_field;
37 new const int b_const_three = 4;
39 new int b_int_property {
40 get {
41 return b_int_field;
45 set {
46 b_int_field = value;
51 public Derived ()
53 b_int_field = 10;
54 b_string_field = "derived";
57 public int Test ()
59 if (b_int_field != 10)
60 return 1;
61 if (base.b_int_field != 1)
62 return 2;
63 if (base.b_string_field != "base")
64 return 3;
65 if (b_string_field != "derived")
66 return 4;
67 base.b_int_property = 4;
68 if (b_int_property != 10)
69 return 5;
70 if (b_int_property != 10)
71 return 6;
72 if (base.b_int_property != 4)
73 return 7;
74 if (b_const_three != 4)
75 return 8;
76 if (Base.b_const_three != 3)
77 return 9;
78 System.Console.WriteLine ("All tests pass");
79 return 0;
83 class boot {
84 static int Main ()
86 Derived d = new Derived ();
87 return d.Test ();