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