2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / mbas / Test / tests / InheritanceA.vb
1 Imports System\r
2 \r
3 ' if a class is not derived from any class \r
4 ' means it is derived from Object class\r
5 \r
6 Public Class C1
7     dim t1 as Type = GetType (C1)
8
9     Function f1 (name as string)\r
10         If t1.name <> name Then\r
11             Throw New System.Exception("#A1 Unexpected result")\r
12        End If\r
13     End Function
14
15     Function f1 (name as string, t as type)\r
16         If t.name <> name Then\r
17             Throw New System.Exception("#A2 Unexpected result")\r
18        End If\r
19     End Function\r
20 \r
21     Function fn() As Integer\r
22         Return 5\r
23     End Function\r
24 End Class\r
25 \r
26 Public Class C2\r
27     Inherits C1
28     dim t as Type = GetType (C2)
29 \r
30     Function f2(name as string)\r
31         f1(name, t)\r
32     End Function\r
33 \r
34 \r
35 End Class\r
36 \r
37 Public Class C3\r
38     Inherits C2\r
39 \r
40 End Class\r
41 \r
42 Module Inheritance\r
43     Sub Main()\r
44         Dim c1 As New C1()
45         c1.f1("C1")\r
46 \r
47         Dim c2 As New C2()
48         c2.f1("C1")\r
49         c2.f2("C2")\r
50         c2.fn()\r
51 \r
52         Dim c3 As New c3()
53         c3.f1("C1")\r
54         c3.f2("C2")\r
55         c3.fn()\r
56     End Sub\r
57 End Module\r