6bbac46308acce3a119b3904f848e081f3b8f8d3
[mono.git] / mcs / mbas / Test / tests / Inheritance.vb
1 Imports System\r
2 \r
3 'Testing simple and multi-level inheritence with all methods declared public\r
4 \r
5 Public Class C1\r
6      Public Function f1()As Integer\r
7         Return 1\r
8      End Function\r
9 \r
10     Public Function fn() As Integer\r
11         Return 5\r
12     End Function\r
13 End Class\r
14 \r
15 Public Class C2\r
16     Inherits C1\r
17     Public Function f2()As Integer\r
18         Return f1()\r
19     End Function\r
20 End Class\r
21 \r
22 Public Class c3\r
23     Inherits C2\r
24 End Class\r
25 \r
26 Module Inheritance\r
27     Sub Main()\r
28 \r
29         Dim c1 As New C1()\r
30         Dim a As Integer=c1.f1()\r
31         If a<>1 Then\r
32                 Throw New Exception("#A1- Inheritence:Failed")\r
33         End If\r
34 \r
35         Dim c2 As New C2()\r
36         Dim b As Integer = c2.f1()\r
37         Dim c As Integer = c2.f2()\r
38         Dim d As Integer = c2.fn()\r
39 \r
40         If b<>1 Then\r
41                  Throw New Exception("#A2- Inheritence:Failed")\r
42         End If\r
43          If c<>1 Then\r
44                  Throw New Exception("#A2- Inheritence:Failed")\r
45         End If\r
46          If d<>5 Then\r
47                  Throw New Exception("#A2- Inheritence:Failed")\r
48         End If\r
49 \r
50 \r
51         Dim c3 As New c3()\r
52         b=c3.f1()\r
53         c=c3.f2()\r
54         d=c3.fn()\r
55 \r
56         If b<>1 Then\r
57                  Throw New Exception("#A3- Inheritence:Failed")\r
58         End If\r
59          If c<>1 Then\r
60                  Throw New Exception("#A3- Inheritence:Failed")\r
61         End If\r
62          If d<>5 Then\r
63                  Throw New Exception("#A3- Inheritence:Failed")\r
64         End If\r
65 \r
66     End Sub\r
67 End Module\r