Allow passing null to JsonArray.Add()
[mono.git] / mcs / tests / test-27.cs
1 using System;
2
3 public interface Hello {
4
5         bool MyMethod (int i);
6 }
7
8 public interface Another : Hello {
9
10         int AnotherMethod (int i);
11 }
12
13 public class Foo : Hello, Another {
14
15         public bool MyMethod (int i)
16         {
17                 if (i == 22)
18                         return true;
19                 else
20                         return false;
21         }
22
23         public int AnotherMethod (int i)
24         {
25                 return i * 10;
26         }
27         
28 }
29
30 public interface ITest {
31
32         bool TestMethod (int i, float j);
33 }
34
35 public class Blah : Foo {
36
37         public delegate void MyDelegate (int i, int j);
38
39         void Bar (int i, int j)
40         {
41                 Console.WriteLine (i+j);
42         }
43         
44         public static int Main ()
45         {
46                 Blah k = new Blah ();
47
48                 Foo f = k;
49
50                 object o = k;
51
52                 if (f is Foo)
53                         Console.WriteLine ("I am a Foo!");
54
55                 Hello ihello = f;
56
57                 Another ianother = f;
58
59                 ihello = ianother; 
60
61                 bool b = f.MyMethod (22);
62
63                 MyDelegate del = new MyDelegate (k.Bar);
64
65                 del (2, 3);
66                 
67                 Delegate tmp = del;
68
69                 // Explicit reference conversions
70                 
71                 MyDelegate adel = (MyDelegate) tmp;
72
73                 adel (4, 7);
74
75                 Blah l = (Blah) o;
76
77                 l.Bar (20, 30);
78
79                 l = (Blah) f;
80
81                 l.Bar (2, 5);
82
83                 f = (Foo) ihello;
84
85                 // The following cause exceptions even though they are supposed to work
86                 // according to the spec
87
88                 // This one sounds ridiculous !
89                 // ITest t = (ITest) l;
90                 
91                 // ITest u = (ITest) ihello;
92
93                 return 0;
94
95         }
96 }
97