New folder for holding the VB.NET compiler test cases.
[mono.git] / mcs / mbas / Test / tests / ConstructorB.vb
1 Imports System
2
3 Class A
4         public Sub New()
5         End Sub
6
7         public Sub New(name as String)
8                 if name <> "abc" then
9                         throw new exception ("#A1, Unexpected result")
10                 end if
11         End Sub
12 End Class
13
14 Class B
15         Inherits A
16
17         ' call base class ctor explicitly
18         public Sub New()
19                 MyBase.New()
20         End Sub
21 End Class
22
23 Class C
24         Inherits A
25
26         ' call base class ctor with parameter
27         public Sub New()
28                 MyBase.NEw("abc")
29         End Sub
30 End Class
31
32 Class D
33
34         ' call another ctor in the same class
35         ' either of the methods mentioned below should give same result
36         public Sub New()
37                 MyClass.NEw("aaa")
38                 'Me.NEw("aaa")
39         End Sub
40
41         public Sub New(name as String)
42                 if name <> "aaa" then
43                         throw new exception ("#A2, Unexpected result")
44                 end if
45         End Sub
46 End Class
47
48 Module M
49         Sub Main()
50                 dim x as B = new B()
51                 dim y as C = new C()
52                 dim z as D = new D()
53         End Sub
54 End Module